@itwin/core-backend 5.0.0-dev.65 → 5.0.0-dev.67

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +13 -22
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BriefcaseManager.js +12 -12
  6. package/lib/cjs/BriefcaseManager.js.map +1 -1
  7. package/lib/cjs/ChangeSummaryManager.js +3 -3
  8. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  9. package/lib/cjs/ChangedElementsDb.js +6 -6
  10. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  11. package/lib/cjs/CheckpointManager.js +7 -7
  12. package/lib/cjs/CheckpointManager.js.map +1 -1
  13. package/lib/cjs/HubMock.d.ts +1 -1
  14. package/lib/cjs/HubMock.d.ts.map +1 -1
  15. package/lib/cjs/HubMock.js +5 -4
  16. package/lib/cjs/HubMock.js.map +1 -1
  17. package/lib/cjs/IModelDb.d.ts.map +1 -1
  18. package/lib/cjs/IModelDb.js +1 -1
  19. package/lib/cjs/IModelDb.js.map +1 -1
  20. package/lib/cjs/IModelHost.d.ts +14 -7
  21. package/lib/cjs/IModelHost.d.ts.map +1 -1
  22. package/lib/cjs/IModelHost.js +19 -7
  23. package/lib/cjs/IModelHost.js.map +1 -1
  24. package/lib/cjs/ImageSourceConversion.d.ts +49 -0
  25. package/lib/cjs/ImageSourceConversion.d.ts.map +1 -0
  26. package/lib/cjs/ImageSourceConversion.js +37 -0
  27. package/lib/cjs/ImageSourceConversion.js.map +1 -0
  28. package/lib/cjs/TxnManager.d.ts +6 -0
  29. package/lib/cjs/TxnManager.d.ts.map +1 -1
  30. package/lib/cjs/TxnManager.js +8 -0
  31. package/lib/cjs/TxnManager.js.map +1 -1
  32. package/lib/cjs/core-backend.d.ts +5 -0
  33. package/lib/cjs/core-backend.d.ts.map +1 -1
  34. package/lib/cjs/core-backend.js +5 -0
  35. package/lib/cjs/core-backend.js.map +1 -1
  36. package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -1
  37. package/lib/cjs/internal/ServerBasedLocks.js +2 -2
  38. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  39. package/lib/cjs/internal/Symbols.d.ts +4 -0
  40. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  41. package/lib/cjs/internal/Symbols.js +5 -1
  42. package/lib/cjs/internal/Symbols.js.map +1 -1
  43. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +2 -2
  44. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  45. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
  46. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +3 -2
  47. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  48. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"TxnManager.js","sourceRoot":"","sources":["../../src/TxnManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAwEH,wDAIC;AA1ED,+BAA+B;AAC/B,sDAE6B;AAC7B,oDAA0L;AAC1L,mEAAgE;AAEhE,uCAAoC;AAGpC,gDAA+C;AAC/C,4EAAuH;AA0DvH,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;AAED,iIAAiI;AACjI,MAAM,oBAAoB;IACR,SAAS,GAAG,IAAI,+BAAgB,EAAE,CAAC;IAClC,aAAa,GAAa,EAAE,CAAC;IAC7B,SAAS,CAAuB;IAEjD,YAAmB,QAA8B;QAC/C,IAAI,CAAC,SAAS,GAAG,QAAQ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AAC,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,CAAC;YACV,IAAI,GAAG,EAAE,eAAe,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,EAAE,IAAI,CAAC,qBAAqB,IAAI,KAAK,CAAC,CAAC;IACzG,CAAC;IAED;;OAEG;IACI,2BAA2B;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAS,CAAC,CAAC,2BAA2B,EAAE,CAAC;IAC/D,CAAC;CACF;AAnZD,gCAmZC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport * as touch from \"touch\";\nimport {\n assert, BeEvent, BentleyError, compareStrings, CompressedId64Set, DbConflictResolution, DbResult, Id64Array, Id64String, IModelStatus, IndexMap, Logger, OrderedId64Array\n} from \"@itwin/core-bentley\";\nimport { EntityIdAndClassIdIterable, IModelError, ModelGeometryChangesProps, ModelIdAndGeometryGuid, NotifyEntitiesChangedArgs, NotifyEntitiesChangedMetadata } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { BriefcaseDb, StandaloneDb } from \"./IModelDb\";\nimport { IpcHost } from \"./IpcHost\";\nimport { Relationship, RelationshipProps } from \"./Relationship\";\nimport { SqliteStatement } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { DbRebaseChangesetConflictArgs, RebaseChangesetConflictArgs, TxnArgs } from \"./internal/ChangesetConflictArgs\";\n\n/** A string that identifies a Txn.\n * @public\n */\nexport type TxnIdString = string;\n\n/** An error generated during dependency validation.\n * @see [[TxnManager.validationErrors]].\n * @public\n */\nexport interface ValidationError {\n /** If true, txn is aborted. */\n fatal: boolean;\n /** The type of error. */\n errorType: string;\n /** Optional description of what went wrong. */\n message?: string;\n}\n\n/** Describes a set of [[Element]]s or [[Model]]s that changed as part of a transaction.\n * @see [[TxnManager.onElementsChanged]] and [[TxnManager.onModelsChanged]].\n * @public\n */\nexport interface TxnChangedEntities {\n /** The entities that were inserted by the transaction. */\n readonly inserts: EntityIdAndClassIdIterable;\n /** The entities that were deleted by the transaction. */\n readonly deletes: EntityIdAndClassIdIterable;\n /** The entities that were modified by the transaction, including any [[Element]]s for which one of their [[ElementAspect]]s was changed. */\n readonly updates: EntityIdAndClassIdIterable;\n}\n\n/** Arguments supplied to [[TxnManager.queryLocalChanges]].\n * @beta\n */\nexport interface QueryLocalChangesArgs {\n /** If supplied and non-empty, restricts the results to include only EC instances belonging to the specified classes or subclasses thereof. */\n readonly includedClasses?: string[];\n /** If `true`, include changes that have not yet been saved. */\n readonly includeUnsavedChanges?: boolean;\n}\n\n/** Represents a change (insertion, deletion, or modification) to a single EC instance made in a local [[BriefcaseDb]].\n * @see [[TxnManager.queryLocalChanges]] to iterate all of the changed instances.\n* @beta\n*/\nexport interface ChangeInstanceKey {\n /** ECInstanceId of the instance. */\n id: Id64String;\n /** Fully-qualified class name of the instance. */\n classFullName: string;\n /** The type of change. */\n changeType: \"inserted\" | \"updated\" | \"deleted\";\n}\n\ntype EntitiesChangedEvent = BeEvent<(changes: TxnChangedEntities) => void>;\n\n/** Strictly for tests. @internal */\nexport function setMaxEntitiesPerEvent(max: number): number {\n const prevMax = ChangedEntitiesProc.maxPerEvent;\n ChangedEntitiesProc.maxPerEvent = max;\n return prevMax;\n}\n\n/** Maintains an ordered array of entity Ids and a parallel array containing the index of the corresponding entity's class Id. */\nclass ChangedEntitiesArray {\n public readonly entityIds = new OrderedId64Array();\n private readonly _classIndices: number[] = [];\n private readonly _classIds: IndexMap<Id64String>;\n\n public constructor(classIds: IndexMap<Id64String>) {\n this._classIds = classIds;\n }\n\n public insert(entityId: Id64String, classId: Id64String): void {\n const entityIndex = this.entityIds.insert(entityId);\n const classIndex = this._classIds.insert(classId);\n assert(classIndex >= 0);\n if (this.entityIds.length !== this._classIndices.length) {\n // New entity - insert corresponding class index entry.\n this._classIndices.splice(entityIndex, 0, classIndex);\n } else {\n // Existing entity - update corresponding class index.\n // (We do this because apparently connectors can (very rarely) change the class Id of an existing element).\n this._classIndices[entityIndex] = classIndex;\n }\n\n assert(this.entityIds.length === this._classIndices.length);\n }\n\n public clear(): void {\n this.entityIds.clear();\n this._classIndices.length = 0;\n }\n\n public addToChangedEntities(entities: NotifyEntitiesChangedArgs, type: \"deleted\" | \"inserted\" | \"updated\"): void {\n if (this.entityIds.length > 0)\n entities[type] = CompressedId64Set.compressIds(this.entityIds);\n\n entities[`${type}Meta`] = this._classIndices;\n }\n\n public iterable(classIds: Id64Array): EntityIdAndClassIdIterable {\n function* iterator(entityIds: ReadonlyArray<Id64String>, classIndices: number[]) {\n const entity = { id: \"\", classId: \"\" };\n for (let i = 0; i < entityIds.length; i++) {\n entity.id = entityIds[i];\n entity.classId = classIds[classIndices[i]];\n yield entity;\n }\n }\n\n return {\n [Symbol.iterator]: () => iterator(this.entityIds.array, this._classIndices),\n };\n }\n}\n\nclass ChangedEntitiesProc {\n private readonly _classIds = new IndexMap<Id64String>((lhs, rhs) => compareStrings(lhs, rhs));\n private readonly _inserted = new ChangedEntitiesArray(this._classIds);\n private readonly _deleted = new ChangedEntitiesArray(this._classIds);\n private readonly _updated = new ChangedEntitiesArray(this._classIds);\n private _currSize = 0;\n\n public static maxPerEvent = 1000;\n\n public static process(iModel: BriefcaseDb | StandaloneDb, mgr: TxnManager): void {\n if (mgr.isDisposed) {\n // The iModel is being closed. Do not prepare new sqlite statements.\n return;\n }\n\n this.processChanges(iModel, mgr.onElementsChanged, \"notifyElementsChanged\");\n this.processChanges(iModel, mgr.onModelsChanged, \"notifyModelsChanged\");\n }\n\n private populateMetadata(db: BriefcaseDb | StandaloneDb, classIds: Id64Array): NotifyEntitiesChangedMetadata[] {\n // Ensure metadata for all class Ids is loaded. Loading metadata for a derived class loads metadata for all of its superclasses.\n const classIdsToLoad = classIds.filter((x) => undefined === db.classMetaDataRegistry.findByClassId(x));\n if (classIdsToLoad.length > 0) {\n const classIdsStr = classIdsToLoad.join(\",\");\n const sql = `SELECT ec_class.Name, ec_class.Id, ec_schema.Name FROM ec_class JOIN ec_schema WHERE ec_schema.Id = ec_class.SchemaId AND ec_class.Id IN (${classIdsStr})`;\n db.withPreparedSqliteStatement(sql, (stmt) => {\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\n const classFullName = `${stmt.getValueString(2)}:${stmt.getValueString(0)}`;\n db.tryGetMetaData(classFullName);\n }\n });\n }\n\n // Define array indices for the metadata array entries correlating to the class Ids in the input list.\n const nameToIndex = new Map<string, number>();\n for (const classId of classIds) {\n const meta = db.classMetaDataRegistry.findByClassId(classId);\n nameToIndex.set(meta?.ecclass ?? \"\", nameToIndex.size);\n }\n\n const result: NotifyEntitiesChangedMetadata[] = [];\n\n function addMetadata(name: string, index: number): void {\n const bases: number[] = [];\n result[index] = { name, bases };\n\n const meta = db.tryGetMetaData(name);\n if (!meta) {\n return;\n }\n\n for (const baseClassName of meta.baseClasses) {\n let baseClassIndex = nameToIndex.get(baseClassName);\n if (undefined === baseClassIndex) {\n baseClassIndex = nameToIndex.size;\n nameToIndex.set(baseClassName, baseClassIndex);\n addMetadata(baseClassName, baseClassIndex);\n }\n\n bases.push(baseClassIndex);\n }\n }\n\n for (const [name, index] of nameToIndex) {\n if (index >= classIds.length) {\n // Entries beyond this are base classes for the classes in `classIds` - don't reprocess them.\n break;\n }\n\n addMetadata(name, index);\n }\n\n return result;\n }\n\n private sendEvent(iModel: BriefcaseDb | StandaloneDb, evt: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\n if (this._currSize === 0)\n return;\n\n const classIds = this._classIds.toArray();\n\n // Notify backend listeners.\n const txnEntities: TxnChangedEntities = {\n inserts: this._inserted.iterable(classIds),\n deletes: this._deleted.iterable(classIds),\n updates: this._updated.iterable(classIds),\n };\n evt.raiseEvent(txnEntities);\n\n // Notify frontend listeners.\n const entities: NotifyEntitiesChangedArgs = {\n insertedMeta: [],\n updatedMeta: [],\n deletedMeta: [],\n meta: this.populateMetadata(iModel, classIds),\n };\n\n this._inserted.addToChangedEntities(entities, \"inserted\");\n this._deleted.addToChangedEntities(entities, \"deleted\");\n this._updated.addToChangedEntities(entities, \"updated\");\n\n IpcHost.notifyTxns(iModel, evtName, entities);\n\n // Reset state.\n this._inserted.clear();\n this._deleted.clear();\n this._updated.clear();\n this._classIds.clear();\n this._currSize = 0;\n }\n\n private static processChanges(iModel: BriefcaseDb | StandaloneDb, changedEvent: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\n try {\n const maxSize = this.maxPerEvent;\n const changes = new ChangedEntitiesProc();\n const select = \"notifyElementsChanged\" === evtName\n ? \"SELECT ElementId, ChangeType, ECClassId FROM temp.txn_Elements\"\n : \"SELECT ModelId, ChangeType, ECClassId FROM temp.txn_Models\";\n iModel.withPreparedSqliteStatement(select, (sql: SqliteStatement) => {\n const stmt = sql.stmt;\n while (sql.step() === DbResult.BE_SQLITE_ROW) {\n const id = stmt.getValueId(0);\n const classId = stmt.getValueId(2);\n switch (stmt.getValueInteger(1)) {\n case 0:\n changes._inserted.insert(id, classId);\n break;\n case 1:\n changes._updated.insert(id, classId);\n break;\n case 2:\n changes._deleted.insert(id, classId);\n break;\n }\n\n if (++changes._currSize >= maxSize)\n changes.sendEvent(iModel, changedEvent, evtName);\n }\n });\n\n changes.sendEvent(iModel, changedEvent, evtName);\n } catch (err) {\n Logger.logError(BackendLoggerCategory.IModelDb, BentleyError.getErrorMessage(err));\n }\n }\n}\n\n/** @internal */\ninterface IConflictHandler {\n handler: (arg: RebaseChangesetConflictArgs) => DbConflictResolution | undefined;\n next: IConflictHandler | undefined;\n id: string;\n}\n\n/**\n * @internal\n * Manages conflict resolution during a merge operation.\n*/\nexport class ChangeMergeManager {\n private _conflictHandlers?: IConflictHandler;\n public constructor(private _iModel: BriefcaseDb | StandaloneDb) { }\n public resume() {\n this._iModel[_nativeDb].pullMergeResume();\n }\n public inProgress() {\n return this._iModel[_nativeDb].pullMergeInProgress();\n }\n public onConflict(args: RebaseChangesetConflictArgs): DbConflictResolution | undefined {\n let curr = this._conflictHandlers;\n while (curr) {\n const resolution = curr.handler(args);\n if (resolution !== undefined) {\n Logger.logTrace(BackendLoggerCategory.IModelDb, `Conflict handler ${curr.id} resolved conflict`);\n return resolution;\n }\n curr = curr.next;\n }\n return undefined\n }\n public addConflictHandler(args: { id: string, handler: (args: RebaseChangesetConflictArgs) => DbConflictResolution | undefined }) {\n const idExists = (id: string) => {\n let curr = this._conflictHandlers;\n while (curr) {\n if (curr.id === id)\n return true;\n curr = curr.next;\n }\n return false;\n }\n if (idExists(args.id))\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Conflict handler with id ${args.id} already exists`);\n this._conflictHandlers = { ...args, next: this._conflictHandlers };\n }\n public removeConflictHandler(id: string) {\n if (!this._conflictHandlers)\n return;\n\n if (this._conflictHandlers?.id === id) {\n this._conflictHandlers = this._conflictHandlers.next;\n return;\n }\n\n let prev = this._conflictHandlers;\n let curr = this._conflictHandlers?.next;\n while (curr) {\n if (curr.id === id) {\n prev.next = curr.next;\n return;\n }\n prev = curr;\n curr = curr.next;\n }\n }\n}\n\n/** Manages local changes to a [[BriefcaseDb]] or [[StandaloneDb]] via [Txns]($docs/learning/InteractiveEditing.md)\n * @public\n */\nexport class TxnManager {\n /** @internal */\n private _isDisposed = false;\n\n /** @internal */\n public get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /** @internal */\n public readonly changeMergeManager: ChangeMergeManager;\n\n /** @internal */\n constructor(private _iModel: BriefcaseDb | StandaloneDb) {\n this.changeMergeManager = new ChangeMergeManager(_iModel);\n _iModel.onBeforeClose.addOnce(() => {\n this._isDisposed = true;\n });\n }\n\n /** Array of errors from dependency propagation */\n public readonly validationErrors: ValidationError[] = [];\n\n private get _nativeDb() { return this._iModel[_nativeDb]; }\n private _getElementClass(elClassName: string): typeof Element {\n return this._iModel.getJsClass(elClassName) as unknown as typeof Element;\n }\n private _getRelationshipClass(relClassName: string): typeof Relationship {\n return this._iModel.getJsClass<typeof Relationship>(relClassName);\n }\n\n /** If a -watch file exists for this iModel, update its timestamp so watching processes can be\n * notified that we've modified the briefcase.\n * @internal Used by IModelDb on push/pull.\n */\n public touchWatchFile(): void {\n // This is an async call. We don't have any reason to await it.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n touch(this._iModel.watchFilePathName, { nocreate: true });\n }\n\n /** @internal */\n protected _onBeforeOutputsHandled(elClassName: string, elId: Id64String): void {\n (this._getElementClass(elClassName) as any).onBeforeOutputsHandled(elId, this._iModel);\n }\n /** @internal */\n protected _onAllInputsHandled(elClassName: string, elId: Id64String): void {\n (this._getElementClass(elClassName) as any).onAllInputsHandled(elId, this._iModel);\n }\n /** @internal */\n protected _onRootChanged(props: RelationshipProps): void {\n this._getRelationshipClass(props.classFullName).onRootChanged(props, this._iModel);\n }\n /** @internal */\n protected _onDeletedDependency(props: RelationshipProps): void {\n this._getRelationshipClass(props.classFullName).onDeletedDependency(props, this._iModel);\n }\n /** @internal */\n protected _onBeginValidate() { this.validationErrors.length = 0; }\n\n /** called from native code after validation of a Txn, either from saveChanges or apply changeset.\n * @internal\n */\n protected _onEndValidate() {\n ChangedEntitiesProc.process(this._iModel, this);\n this.onEndValidation.raiseEvent();\n // TODO: if (this.validationErrors.length !== 0) throw new IModelError(validation ...)\n }\n\n /** @internal */\n protected _onGeometryChanged(modelProps: ModelGeometryChangesProps[]) {\n this.onGeometryChanged.raiseEvent(modelProps);\n IpcHost.notifyEditingScope(this._iModel, \"notifyGeometryChanged\", modelProps); // send to frontend\n }\n\n /** @internal */\n protected _onGeometryGuidsChanged(changes: ModelIdAndGeometryGuid[]): void {\n this.onModelGeometryChanged.raiseEvent(changes);\n IpcHost.notifyTxns(this._iModel, \"notifyGeometryGuidsChanged\", changes);\n }\n\n /** @internal */\n protected _onCommit() {\n this.onCommit.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyCommit\");\n }\n\n /** @internal */\n protected _onCommitted() {\n this.touchWatchFile();\n this.onCommitted.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyCommitted\", this.hasPendingTxns, Date.now());\n }\n\n /** @internal */\n protected _onReplayExternalTxns() {\n this.onReplayExternalTxns.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyReplayExternalTxns\");\n }\n\n /** @internal */\n protected _onReplayedExternalTxns() {\n this.onReplayedExternalTxns.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyReplayedExternalTxns\");\n }\n\n /** @internal */\n protected _onChangesApplied() {\n ChangedEntitiesProc.process(this._iModel, this);\n this.onChangesApplied.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyChangesApplied\");\n }\n\n /** @internal */\n protected _onBeforeUndoRedo(isUndo: boolean) {\n this.onBeforeUndoRedo.raiseEvent(isUndo);\n IpcHost.notifyTxns(this._iModel, \"notifyBeforeUndoRedo\", isUndo);\n }\n\n /** @internal */\n protected _onAfterUndoRedo(isUndo: boolean) {\n this.touchWatchFile();\n this.onAfterUndoRedo.raiseEvent(isUndo);\n IpcHost.notifyTxns(this._iModel, \"notifyAfterUndoRedo\", isUndo);\n }\n\n private _onRebaseTxnBegin(txn: TxnArgs) {\n this.onRebaseTxnBegin.raiseEvent(txn);\n }\n\n private _onRebaseTxnEnd(txn: TxnArgs) {\n this.onRebaseTxnEnd.raiseEvent(txn);\n }\n\n private _onRebaseLocalTxnConflict(internalArg: DbRebaseChangesetConflictArgs): DbConflictResolution {\n const args = new RebaseChangesetConflictArgs(internalArg, this._iModel);\n\n const getChangeMetaData = () => {\n return {\n parent: this._iModel.changeset,\n txn: args.txn,\n table: args.tableName,\n op: args.opcode,\n cause: args.cause,\n indirect: args.indirect,\n primarykey: args.getPrimaryKeyValues(),\n fkConflictCount: args.cause === \"ForeignKey\" ? args.getForeignKeyConflicts() : undefined,\n };\n }\n\n // Default conflict resolution for which custom handler is never called.\n if (args.cause === \"Data\" && !args.indirect) {\n if (args.tableName === \"be_Prop\") {\n if (args.getValueText(0, \"Old\") === \"ec_Db\" && args.getValueText(1, \"Old\") === \"localDbInfo\") {\n return DbConflictResolution.Skip;\n }\n }\n if (args.tableName.startsWith(\"ec_\")) {\n return DbConflictResolution.Skip;\n }\n }\n\n if (args.cause === \"Conflict\") {\n if (args.tableName.startsWith(\"ec_\")) {\n return DbConflictResolution.Skip;\n }\n }\n\n try {\n const resolution = this.changeMergeManager.onConflict(args);\n if (resolution !== undefined)\n return resolution;\n } catch (err) {\n const msg = `Rebase failed. Custom conflict handler should not throw exception. Aborting txn. ${BentleyError.getErrorMessage(err)}`;\n Logger.logError(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"Data\" && !args.indirect) {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"UPDATE/DELETE before value do not match with one in db or CASCADE action was triggered. Local change will replace existing.\", getChangeMetaData());\n return DbConflictResolution.Replace;\n }\n\n if (args.cause === \"Conflict\") {\n const msg = \"PRIMARY KEY insert conflict. Aborting rebase.\";\n Logger.logError(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"ForeignKey\") {\n const msg = `Foreign key conflicts in ChangeSet. Aborting rebase.`;\n Logger.logInfo(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"NotFound\") {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"PRIMARY KEY not found. Skipping local change.\", getChangeMetaData());\n return DbConflictResolution.Skip;\n }\n\n if (args.cause === \"Constraint\") {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"Constraint voilation detected. Generally caused by db constraints like UNIQUE index. Skipping local change.\", getChangeMetaData());\n return DbConflictResolution.Skip;\n }\n\n return DbConflictResolution.Replace;\n }\n\n /** Dependency handlers may call method this to report a validation error.\n * @param error The error. If error.fatal === true, the transaction will cancel rather than commit.\n */\n public reportError(error: ValidationError) {\n this.validationErrors.push(error);\n this._nativeDb.logTxnError(error.fatal);\n }\n\n /** Determine whether any fatal validation errors have occurred during dependency propagation. */\n public get hasFatalError(): boolean { return this._nativeDb.hasFatalTxnError(); }\n\n /** @internal */\n public readonly onEndValidation = new BeEvent<() => void>();\n\n /** Called after validation completes from [[IModelDb.saveChanges]].\n * The argument to the event holds the list of elements that were inserted, updated, and deleted.\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.\n */\n public readonly onElementsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\n\n /** Called after validation completes from [[IModelDb.saveChanges]].\n * The argument to the event holds the list of models that were inserted, updated, and deleted.\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.\n */\n public readonly onModelsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\n\n /** Event raised after the geometry within one or more [[GeometricModel]]s is modified by applying a changeset or validation of a transaction.\n * A model's geometry can change as a result of:\n * - Insertion or deletion of a geometric element within the model; or\n * - Modification of an existing element's geometric properties; or\n * - An explicit request to flag it as changed via [[IModelDb.Models.updateModel]].\n */\n public readonly onModelGeometryChanged = new BeEvent<(changes: ReadonlyArray<ModelIdAndGeometryGuid>) => void>();\n\n public readonly onGeometryChanged = new BeEvent<(models: ModelGeometryChangesProps[]) => void>();\n /** Event raised before a commit operation is performed. Initiated by a call to [[IModelDb.saveChanges]], unless there are no changes to save. */\n public readonly onCommit = new BeEvent<() => void>();\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. */\n public readonly onCommitted = new BeEvent<() => void>();\n /** Event raised after a ChangeSet has been applied to this briefcase */\n public readonly onChangesApplied = new BeEvent<() => void>();\n /** Event raised before an undo/redo operation is performed. */\n public readonly onBeforeUndoRedo = new BeEvent<(isUndo: boolean) => void>();\n /** Event raised after an undo/redo operation has been performed.\n * @param _action The action that was performed.\n */\n public readonly onAfterUndoRedo = new BeEvent<(isUndo: boolean) => void>();\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.\n * @see [[onReplayedExternalTxns]] for the event raised after all such changes have been applied.\n */\n public readonly onReplayExternalTxns = new BeEvent<() => void>();\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.\n * @see [[onReplayExternalTxns]] for the event raised before the changes are applied.\n */\n public readonly onReplayedExternalTxns = new BeEvent<() => void>();\n\n /** @internal */\n public readonly onRebaseTxnBegin = new BeEvent<(txn: TxnArgs) => void>();\n /** @internal */\n public readonly onRebaseTxnEnd = new BeEvent<(txn: TxnArgs) => void>();\n /**\n * if handler is set and it does not return undefiend then default handler will not be called\n * @internal\n * */\n public appCustomConflictHandler?: (args: DbRebaseChangesetConflictArgs) => DbConflictResolution | undefined;\n\n /**\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\n * and reopened.)\n * @note This can be quite disconcerting to the user expecting to be able to undo previously made changes. It should only be used\n * under extreme circumstances where damage to the file or session could happen if the currently committed are reversed. Use sparingly and with care.\n * Probably a good idea to alert the user it happened.\n */\n public restartSession() {\n this._nativeDb.restartTxnSession();\n }\n\n /** Determine whether current txn is propagating indirect changes or not. */\n public get isIndirectChanges(): boolean { return this._nativeDb.isIndirectChanges(); }\n\n /** Determine if there are currently any reversible (undoable) changes from this editing session. */\n public get isUndoPossible(): boolean { return this._nativeDb.isUndoPossible(); }\n\n /** Determine if there are currently any reinstatable (redoable) changes */\n public get isRedoPossible(): boolean { return this._nativeDb.isRedoPossible(); }\n\n /** Get the description of the operation that would be reversed by calling reverseTxns(1).\n * This is useful for showing the operation that would be undone, for example in a menu.\n */\n public getUndoString(): string { return this._nativeDb.getUndoString(); }\n\n /** Get a description of the operation that would be reinstated by calling reinstateTxn.\n * This is useful for showing the operation that would be redone, in a pull-down menu for example.\n */\n public getRedoString(): string { return this._nativeDb.getRedoString(); }\n\n /** Begin a new multi-Txn operation. This can be used to cause a series of Txns that would normally\n * be considered separate actions for undo to be grouped into a single undoable operation. This means that when reverseTxns(1) is called,\n * the entire group of changes are undone together. Multi-Txn operations can be nested and until the outermost operation is closed\n * all changes constitute a single operation.\n * @note This method must always be paired with a call to endMultiTxnAction.\n */\n public beginMultiTxnOperation(): DbResult { return this._nativeDb.beginMultiTxnOperation(); }\n\n /** End a multi-Txn operation */\n public endMultiTxnOperation(): DbResult { return this._nativeDb.endMultiTxnOperation(); }\n\n /** Return the depth of the multi-Txn stack. Generally for diagnostic use only. */\n public getMultiTxnOperationDepth(): number { return this._nativeDb.getMultiTxnOperationDepth(); }\n\n /** Reverse (undo) the most recent operation(s) to this IModelDb.\n * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will\n * be reinstated together when/if ReinstateTxn is called.\n * @note If there are any outstanding uncommitted changes, they are reversed.\n * @note The term \"operation\" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,\n * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.\n * @note If numOperations is too large only the operations are reversible are reversed.\n */\n public reverseTxns(numOperations: number): IModelStatus {\n return this._nativeDb.reverseTxns(numOperations);\n }\n\n /** Reverse the most recent operation. */\n public reverseSingleTxn(): IModelStatus { return this.reverseTxns(1); }\n\n /** Reverse all changes back to the beginning of the session. */\n public reverseAll(): IModelStatus { return this._nativeDb.reverseAll(); }\n\n /** Reverse all changes back to a previously saved TxnId.\n * @param txnId a TxnId obtained from a previous call to GetCurrentTxnId.\n * @returns Success if the transactions were reversed, error status otherwise.\n * @see [[getCurrentTxnId]] [[cancelTo]]\n */\n public reverseTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.reverseTo(txnId); }\n\n /** Reverse and then cancel (make non-reinstatable) all changes back to a previous TxnId.\n * @param txnId a TxnId obtained from a previous call to [[getCurrentTxnId]]\n * @returns Success if the transactions were reversed and cleared, error status otherwise.\n */\n public cancelTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.cancelTo(txnId); }\n\n /** Reinstate the most recently reversed transaction. Since at any time multiple transactions can be reversed, it\n * may take multiple calls to this method to reinstate all reversed operations.\n * @returns Success if a reversed transaction was reinstated, error status otherwise.\n * @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.\n */\n public reinstateTxn(): IModelStatus { return this._iModel.reinstateTxn(); }\n\n /** Get the Id of the first transaction, if any.\n */\n public queryFirstTxnId(): TxnIdString { return this._nativeDb.queryFirstTxnId(); }\n\n /** Get the successor of the specified TxnId */\n public queryNextTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryNextTxnId(txnId); }\n\n /** Get the predecessor of the specified TxnId */\n public queryPreviousTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryPreviousTxnId(txnId); }\n\n /** Get the Id of the current (tip) transaction. */\n public getCurrentTxnId(): TxnIdString { return this._nativeDb.getCurrentTxnId(); }\n\n /** Get the description that was supplied when the specified transaction was saved. */\n public getTxnDescription(txnId: TxnIdString): string { return this._nativeDb.getTxnDescription(txnId); }\n\n /** Test if a TxnId is valid */\n public isTxnIdValid(txnId: TxnIdString): boolean { return this._nativeDb.isTxnIdValid(txnId); }\n\n /** Query if there are any pending Txns in this IModelDb that are waiting to be pushed. */\n public get hasPendingTxns(): boolean { return this._nativeDb.hasPendingTxns(); }\n\n /** Query if there are any changes in memory that have yet to be saved to the IModelDb. */\n public get hasUnsavedChanges(): boolean { return this._nativeDb.hasUnsavedChanges(); }\n\n /** Query if there are un-saved or un-pushed local changes. */\n public get hasLocalChanges(): boolean { return this.hasUnsavedChanges || this.hasPendingTxns; }\n\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.\n * @beta\n */\n public queryLocalChanges(args?: QueryLocalChangesArgs): Iterable<ChangeInstanceKey> {\n if (!args) {\n args = { includedClasses: [], includeUnsavedChanges: false };\n }\n return this._nativeDb.getLocalChanges(args.includedClasses ?? [], args.includeUnsavedChanges ?? false);\n }\n\n /** Query the number of bytes of memory currently allocated by SQLite to keep track of\n * changes to the iModel, for debugging/diagnostic purposes, as reported by [sqlite3session_memory_used](https://www.sqlite.org/session/sqlite3session_memory_used.html).\n */\n public getChangeTrackingMemoryUsed(): number {\n return this._iModel[_nativeDb].getChangeTrackingMemoryUsed();\n }\n}\n\n"]}
1
+ {"version":3,"file":"TxnManager.js","sourceRoot":"","sources":["../../src/TxnManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAwEH,wDAIC;AA1ED,+BAA+B;AAC/B,sDAE6B;AAC7B,oDAA0L;AAC1L,mEAAgE;AAEhE,uCAAoC;AAGpC,gDAA+C;AAC/C,4EAAuH;AA0DvH,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;AAED,iIAAiI;AACjI,MAAM,oBAAoB;IACR,SAAS,GAAG,IAAI,+BAAgB,EAAE,CAAC;IAClC,aAAa,GAAa,EAAE,CAAC;IAC7B,SAAS,CAAuB;IAEjD,YAAmB,QAA8B;QAC/C,IAAI,CAAC,SAAS,GAAG,QAAQ,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C,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;;;;OAIG;IACI,aAAa;QAClB,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;IACjC,CAAC;IAED;;MAEE;IACK,iBAAiB,CAAC,IAA4B;QACnD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,EAAE,eAAe,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,EAAE,IAAI,CAAC,qBAAqB,IAAI,KAAK,CAAC,CAAC;IACzG,CAAC;IAED;;OAEG;IACI,2BAA2B;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAS,CAAC,CAAC,2BAA2B,EAAE,CAAC;IAC/D,CAAC;CACF;AA5ZD,gCA4ZC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport * as touch from \"touch\";\nimport {\n assert, BeEvent, BentleyError, compareStrings, CompressedId64Set, DbConflictResolution, DbResult, Id64Array, Id64String, IModelStatus, IndexMap, Logger, OrderedId64Array\n} from \"@itwin/core-bentley\";\nimport { EntityIdAndClassIdIterable, IModelError, ModelGeometryChangesProps, ModelIdAndGeometryGuid, NotifyEntitiesChangedArgs, NotifyEntitiesChangedMetadata } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { BriefcaseDb, StandaloneDb } from \"./IModelDb\";\nimport { IpcHost } from \"./IpcHost\";\nimport { Relationship, RelationshipProps } from \"./Relationship\";\nimport { SqliteStatement } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { DbRebaseChangesetConflictArgs, RebaseChangesetConflictArgs, TxnArgs } from \"./internal/ChangesetConflictArgs\";\n\n/** A string that identifies a Txn.\n * @public\n */\nexport type TxnIdString = string;\n\n/** An error generated during dependency validation.\n * @see [[TxnManager.validationErrors]].\n * @public\n */\nexport interface ValidationError {\n /** If true, txn is aborted. */\n fatal: boolean;\n /** The type of error. */\n errorType: string;\n /** Optional description of what went wrong. */\n message?: string;\n}\n\n/** Describes a set of [[Element]]s or [[Model]]s that changed as part of a transaction.\n * @see [[TxnManager.onElementsChanged]] and [[TxnManager.onModelsChanged]].\n * @public\n */\nexport interface TxnChangedEntities {\n /** The entities that were inserted by the transaction. */\n readonly inserts: EntityIdAndClassIdIterable;\n /** The entities that were deleted by the transaction. */\n readonly deletes: EntityIdAndClassIdIterable;\n /** The entities that were modified by the transaction, including any [[Element]]s for which one of their [[ElementAspect]]s was changed. */\n readonly updates: EntityIdAndClassIdIterable;\n}\n\n/** Arguments supplied to [[TxnManager.queryLocalChanges]].\n * @beta\n */\nexport interface QueryLocalChangesArgs {\n /** If supplied and non-empty, restricts the results to include only EC instances belonging to the specified classes or subclasses thereof. */\n readonly includedClasses?: string[];\n /** If `true`, include changes that have not yet been saved. */\n readonly includeUnsavedChanges?: boolean;\n}\n\n/** Represents a change (insertion, deletion, or modification) to a single EC instance made in a local [[BriefcaseDb]].\n * @see [[TxnManager.queryLocalChanges]] to iterate all of the changed instances.\n* @beta\n*/\nexport interface ChangeInstanceKey {\n /** ECInstanceId of the instance. */\n id: Id64String;\n /** Fully-qualified class name of the instance. */\n classFullName: string;\n /** The type of change. */\n changeType: \"inserted\" | \"updated\" | \"deleted\";\n}\n\ntype EntitiesChangedEvent = BeEvent<(changes: TxnChangedEntities) => void>;\n\n/** Strictly for tests. @internal */\nexport function setMaxEntitiesPerEvent(max: number): number {\n const prevMax = ChangedEntitiesProc.maxPerEvent;\n ChangedEntitiesProc.maxPerEvent = max;\n return prevMax;\n}\n\n/** Maintains an ordered array of entity Ids and a parallel array containing the index of the corresponding entity's class Id. */\nclass ChangedEntitiesArray {\n public readonly entityIds = new OrderedId64Array();\n private readonly _classIndices: number[] = [];\n private readonly _classIds: IndexMap<Id64String>;\n\n public constructor(classIds: IndexMap<Id64String>) {\n this._classIds = classIds;\n }\n\n public insert(entityId: Id64String, classId: Id64String): void {\n const entityIndex = this.entityIds.insert(entityId);\n const classIndex = this._classIds.insert(classId);\n assert(classIndex >= 0);\n if (this.entityIds.length !== this._classIndices.length) {\n // New entity - insert corresponding class index entry.\n this._classIndices.splice(entityIndex, 0, classIndex);\n } else {\n // Existing entity - update corresponding class index.\n // (We do this because apparently connectors can (very rarely) change the class Id of an existing element).\n this._classIndices[entityIndex] = classIndex;\n }\n\n assert(this.entityIds.length === this._classIndices.length);\n }\n\n public clear(): void {\n this.entityIds.clear();\n this._classIndices.length = 0;\n }\n\n public addToChangedEntities(entities: NotifyEntitiesChangedArgs, type: \"deleted\" | \"inserted\" | \"updated\"): void {\n if (this.entityIds.length > 0)\n entities[type] = CompressedId64Set.compressIds(this.entityIds);\n\n entities[`${type}Meta`] = this._classIndices;\n }\n\n public iterable(classIds: Id64Array): EntityIdAndClassIdIterable {\n function* iterator(entityIds: ReadonlyArray<Id64String>, classIndices: number[]) {\n const entity = { id: \"\", classId: \"\" };\n for (let i = 0; i < entityIds.length; i++) {\n entity.id = entityIds[i];\n entity.classId = classIds[classIndices[i]];\n yield entity;\n }\n }\n\n return {\n [Symbol.iterator]: () => iterator(this.entityIds.array, this._classIndices),\n };\n }\n}\n\nclass ChangedEntitiesProc {\n private readonly _classIds = new IndexMap<Id64String>((lhs, rhs) => compareStrings(lhs, rhs));\n private readonly _inserted = new ChangedEntitiesArray(this._classIds);\n private readonly _deleted = new ChangedEntitiesArray(this._classIds);\n private readonly _updated = new ChangedEntitiesArray(this._classIds);\n private _currSize = 0;\n\n public static maxPerEvent = 1000;\n\n public static process(iModel: BriefcaseDb | StandaloneDb, mgr: TxnManager): void {\n if (mgr.isDisposed) {\n // The iModel is being closed. Do not prepare new sqlite statements.\n return;\n }\n\n this.processChanges(iModel, mgr.onElementsChanged, \"notifyElementsChanged\");\n this.processChanges(iModel, mgr.onModelsChanged, \"notifyModelsChanged\");\n }\n\n private populateMetadata(db: BriefcaseDb | StandaloneDb, classIds: Id64Array): NotifyEntitiesChangedMetadata[] {\n // Ensure metadata for all class Ids is loaded. Loading metadata for a derived class loads metadata for all of its superclasses.\n const classIdsToLoad = classIds.filter((x) => undefined === db.classMetaDataRegistry.findByClassId(x));\n if (classIdsToLoad.length > 0) {\n const classIdsStr = classIdsToLoad.join(\",\");\n const sql = `SELECT ec_class.Name, ec_class.Id, ec_schema.Name FROM ec_class JOIN ec_schema WHERE ec_schema.Id = ec_class.SchemaId AND ec_class.Id IN (${classIdsStr})`;\n db.withPreparedSqliteStatement(sql, (stmt) => {\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\n const classFullName = `${stmt.getValueString(2)}:${stmt.getValueString(0)}`;\n db.tryGetMetaData(classFullName);\n }\n });\n }\n\n // Define array indices for the metadata array entries correlating to the class Ids in the input list.\n const nameToIndex = new Map<string, number>();\n for (const classId of classIds) {\n const meta = db.classMetaDataRegistry.findByClassId(classId);\n nameToIndex.set(meta?.ecclass ?? \"\", nameToIndex.size);\n }\n\n const result: NotifyEntitiesChangedMetadata[] = [];\n\n function addMetadata(name: string, index: number): void {\n const bases: number[] = [];\n result[index] = { name, bases };\n\n const meta = db.tryGetMetaData(name);\n if (!meta) {\n return;\n }\n\n for (const baseClassName of meta.baseClasses) {\n let baseClassIndex = nameToIndex.get(baseClassName);\n if (undefined === baseClassIndex) {\n baseClassIndex = nameToIndex.size;\n nameToIndex.set(baseClassName, baseClassIndex);\n addMetadata(baseClassName, baseClassIndex);\n }\n\n bases.push(baseClassIndex);\n }\n }\n\n for (const [name, index] of nameToIndex) {\n if (index >= classIds.length) {\n // Entries beyond this are base classes for the classes in `classIds` - don't reprocess them.\n break;\n }\n\n addMetadata(name, index);\n }\n\n return result;\n }\n\n private sendEvent(iModel: BriefcaseDb | StandaloneDb, evt: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\n if (this._currSize === 0)\n return;\n\n const classIds = this._classIds.toArray();\n\n // Notify backend listeners.\n const txnEntities: TxnChangedEntities = {\n inserts: this._inserted.iterable(classIds),\n deletes: this._deleted.iterable(classIds),\n updates: this._updated.iterable(classIds),\n };\n evt.raiseEvent(txnEntities);\n\n // Notify frontend listeners.\n const entities: NotifyEntitiesChangedArgs = {\n insertedMeta: [],\n updatedMeta: [],\n deletedMeta: [],\n meta: this.populateMetadata(iModel, classIds),\n };\n\n this._inserted.addToChangedEntities(entities, \"inserted\");\n this._deleted.addToChangedEntities(entities, \"deleted\");\n this._updated.addToChangedEntities(entities, \"updated\");\n\n IpcHost.notifyTxns(iModel, evtName, entities);\n\n // Reset state.\n this._inserted.clear();\n this._deleted.clear();\n this._updated.clear();\n this._classIds.clear();\n this._currSize = 0;\n }\n\n private static processChanges(iModel: BriefcaseDb | StandaloneDb, changedEvent: EntitiesChangedEvent, evtName: \"notifyElementsChanged\" | \"notifyModelsChanged\") {\n try {\n const maxSize = this.maxPerEvent;\n const changes = new ChangedEntitiesProc();\n const select = \"notifyElementsChanged\" === evtName\n ? \"SELECT ElementId, ChangeType, ECClassId FROM temp.txn_Elements\"\n : \"SELECT ModelId, ChangeType, ECClassId FROM temp.txn_Models\";\n iModel.withPreparedSqliteStatement(select, (sql: SqliteStatement) => {\n const stmt = sql.stmt;\n while (sql.step() === DbResult.BE_SQLITE_ROW) {\n const id = stmt.getValueId(0);\n const classId = stmt.getValueId(2);\n switch (stmt.getValueInteger(1)) {\n case 0:\n changes._inserted.insert(id, classId);\n break;\n case 1:\n changes._updated.insert(id, classId);\n break;\n case 2:\n changes._deleted.insert(id, classId);\n break;\n }\n\n if (++changes._currSize >= maxSize)\n changes.sendEvent(iModel, changedEvent, evtName);\n }\n });\n\n changes.sendEvent(iModel, changedEvent, evtName);\n } catch (err) {\n Logger.logError(BackendLoggerCategory.IModelDb, BentleyError.getErrorMessage(err));\n }\n }\n}\n\n/** @internal */\ninterface IConflictHandler {\n handler: (arg: RebaseChangesetConflictArgs) => DbConflictResolution | undefined;\n next: IConflictHandler | undefined;\n id: string;\n}\n\n/**\n * @internal\n * Manages conflict resolution during a merge operation.\n*/\nexport class ChangeMergeManager {\n private _conflictHandlers?: IConflictHandler;\n public constructor(private _iModel: BriefcaseDb | StandaloneDb) { }\n public resume() {\n this._iModel[_nativeDb].pullMergeResume();\n }\n public inProgress() {\n return this._iModel[_nativeDb].pullMergeInProgress();\n }\n public onConflict(args: RebaseChangesetConflictArgs): DbConflictResolution | undefined {\n let curr = this._conflictHandlers;\n while (curr) {\n const resolution = curr.handler(args);\n if (resolution !== undefined) {\n Logger.logTrace(BackendLoggerCategory.IModelDb, `Conflict handler ${curr.id} resolved conflict`);\n return resolution;\n }\n curr = curr.next;\n }\n return undefined\n }\n public addConflictHandler(args: { id: string, handler: (args: RebaseChangesetConflictArgs) => DbConflictResolution | undefined }) {\n const idExists = (id: string) => {\n let curr = this._conflictHandlers;\n while (curr) {\n if (curr.id === id)\n return true;\n curr = curr.next;\n }\n return false;\n }\n if (idExists(args.id))\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Conflict handler with id ${args.id} already exists`);\n this._conflictHandlers = { ...args, next: this._conflictHandlers };\n }\n public removeConflictHandler(id: string) {\n if (!this._conflictHandlers)\n return;\n\n if (this._conflictHandlers?.id === id) {\n this._conflictHandlers = this._conflictHandlers.next;\n return;\n }\n\n let prev = this._conflictHandlers;\n let curr = this._conflictHandlers?.next;\n while (curr) {\n if (curr.id === id) {\n prev.next = curr.next;\n return;\n }\n prev = curr;\n curr = curr.next;\n }\n }\n}\n\n/** Manages local changes to a [[BriefcaseDb]] or [[StandaloneDb]] via [Txns]($docs/learning/InteractiveEditing.md)\n * @public\n */\nexport class TxnManager {\n /** @internal */\n private _isDisposed = false;\n\n /** @internal */\n public get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /** @internal */\n public readonly changeMergeManager: ChangeMergeManager;\n\n /** @internal */\n constructor(private _iModel: BriefcaseDb | StandaloneDb) {\n this.changeMergeManager = new ChangeMergeManager(_iModel);\n _iModel.onBeforeClose.addOnce(() => {\n this._isDisposed = true;\n });\n }\n\n /** Array of errors from dependency propagation */\n public readonly validationErrors: ValidationError[] = [];\n\n private get _nativeDb() { return this._iModel[_nativeDb]; }\n private _getElementClass(elClassName: string): typeof Element {\n return this._iModel.getJsClass(elClassName) as unknown as typeof Element;\n }\n private _getRelationshipClass(relClassName: string): typeof Relationship {\n return this._iModel.getJsClass<typeof Relationship>(relClassName);\n }\n\n /** If a -watch file exists for this iModel, update its timestamp so watching processes can be\n * notified that we've modified the briefcase.\n * @internal Used by IModelDb on push/pull.\n */\n public touchWatchFile(): void {\n // This is an async call. We don't have any reason to await it.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n touch(this._iModel.watchFilePathName, { nocreate: true });\n }\n\n /** @internal */\n protected _onBeforeOutputsHandled(elClassName: string, elId: Id64String): void {\n (this._getElementClass(elClassName) as any).onBeforeOutputsHandled(elId, this._iModel);\n }\n /** @internal */\n protected _onAllInputsHandled(elClassName: string, elId: Id64String): void {\n (this._getElementClass(elClassName) as any).onAllInputsHandled(elId, this._iModel);\n }\n /** @internal */\n protected _onRootChanged(props: RelationshipProps): void {\n this._getRelationshipClass(props.classFullName).onRootChanged(props, this._iModel);\n }\n /** @internal */\n protected _onDeletedDependency(props: RelationshipProps): void {\n this._getRelationshipClass(props.classFullName).onDeletedDependency(props, this._iModel);\n }\n /** @internal */\n protected _onBeginValidate() { this.validationErrors.length = 0; }\n\n /** called from native code after validation of a Txn, either from saveChanges or apply changeset.\n * @internal\n */\n protected _onEndValidate() {\n ChangedEntitiesProc.process(this._iModel, this);\n this.onEndValidation.raiseEvent();\n // TODO: if (this.validationErrors.length !== 0) throw new IModelError(validation ...)\n }\n\n /** @internal */\n protected _onGeometryChanged(modelProps: ModelGeometryChangesProps[]) {\n this.onGeometryChanged.raiseEvent(modelProps);\n IpcHost.notifyEditingScope(this._iModel, \"notifyGeometryChanged\", modelProps); // send to frontend\n }\n\n /** @internal */\n protected _onGeometryGuidsChanged(changes: ModelIdAndGeometryGuid[]): void {\n this.onModelGeometryChanged.raiseEvent(changes);\n IpcHost.notifyTxns(this._iModel, \"notifyGeometryGuidsChanged\", changes);\n }\n\n /** @internal */\n protected _onCommit() {\n this.onCommit.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyCommit\");\n }\n\n /** @internal */\n protected _onCommitted() {\n this.touchWatchFile();\n this.onCommitted.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyCommitted\", this.hasPendingTxns, Date.now());\n }\n\n /** @internal */\n protected _onReplayExternalTxns() {\n this.onReplayExternalTxns.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyReplayExternalTxns\");\n }\n\n /** @internal */\n protected _onReplayedExternalTxns() {\n this.onReplayedExternalTxns.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyReplayedExternalTxns\");\n }\n\n /** @internal */\n protected _onChangesApplied() {\n ChangedEntitiesProc.process(this._iModel, this);\n this.onChangesApplied.raiseEvent();\n IpcHost.notifyTxns(this._iModel, \"notifyChangesApplied\");\n }\n\n /** @internal */\n protected _onBeforeUndoRedo(isUndo: boolean) {\n this.onBeforeUndoRedo.raiseEvent(isUndo);\n IpcHost.notifyTxns(this._iModel, \"notifyBeforeUndoRedo\", isUndo);\n }\n\n /** @internal */\n protected _onAfterUndoRedo(isUndo: boolean) {\n this.touchWatchFile();\n this.onAfterUndoRedo.raiseEvent(isUndo);\n IpcHost.notifyTxns(this._iModel, \"notifyAfterUndoRedo\", isUndo);\n }\n\n private _onRebaseTxnBegin(txn: TxnArgs) {\n this.onRebaseTxnBegin.raiseEvent(txn);\n }\n\n private _onRebaseTxnEnd(txn: TxnArgs) {\n this.onRebaseTxnEnd.raiseEvent(txn);\n }\n\n private _onRebaseLocalTxnConflict(internalArg: DbRebaseChangesetConflictArgs): DbConflictResolution {\n const args = new RebaseChangesetConflictArgs(internalArg, this._iModel);\n\n const getChangeMetaData = () => {\n return {\n parent: this._iModel.changeset,\n txn: args.txn,\n table: args.tableName,\n op: args.opcode,\n cause: args.cause,\n indirect: args.indirect,\n primarykey: args.getPrimaryKeyValues(),\n fkConflictCount: args.cause === \"ForeignKey\" ? args.getForeignKeyConflicts() : undefined,\n };\n }\n\n // Default conflict resolution for which custom handler is never called.\n if (args.cause === \"Data\" && !args.indirect) {\n if (args.tableName === \"be_Prop\") {\n if (args.getValueText(0, \"Old\") === \"ec_Db\" && args.getValueText(1, \"Old\") === \"localDbInfo\") {\n return DbConflictResolution.Skip;\n }\n }\n if (args.tableName.startsWith(\"ec_\")) {\n return DbConflictResolution.Skip;\n }\n }\n\n if (args.cause === \"Conflict\") {\n if (args.tableName.startsWith(\"ec_\")) {\n return DbConflictResolution.Skip;\n }\n }\n\n try {\n const resolution = this.changeMergeManager.onConflict(args);\n if (resolution !== undefined)\n return resolution;\n } catch (err) {\n const msg = `Rebase failed. Custom conflict handler should not throw exception. Aborting txn. ${BentleyError.getErrorMessage(err)}`;\n Logger.logError(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"Data\" && !args.indirect) {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"UPDATE/DELETE before value do not match with one in db or CASCADE action was triggered. Local change will replace existing.\", getChangeMetaData());\n return DbConflictResolution.Replace;\n }\n\n if (args.cause === \"Conflict\") {\n const msg = \"PRIMARY KEY insert conflict. Aborting rebase.\";\n Logger.logError(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"ForeignKey\") {\n const msg = `Foreign key conflicts in ChangeSet. Aborting rebase.`;\n Logger.logInfo(BackendLoggerCategory.IModelDb, msg, getChangeMetaData());\n args.setLastError(msg);\n return DbConflictResolution.Abort;\n }\n\n if (args.cause === \"NotFound\") {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"PRIMARY KEY not found. Skipping local change.\", getChangeMetaData());\n return DbConflictResolution.Skip;\n }\n\n if (args.cause === \"Constraint\") {\n Logger.logInfo(BackendLoggerCategory.IModelDb, \"Constraint voilation detected. Generally caused by db constraints like UNIQUE index. Skipping local change.\", getChangeMetaData());\n return DbConflictResolution.Skip;\n }\n\n return DbConflictResolution.Replace;\n }\n\n /** Dependency handlers may call method this to report a validation error.\n * @param error The error. If error.fatal === true, the transaction will cancel rather than commit.\n */\n public reportError(error: ValidationError) {\n this.validationErrors.push(error);\n this._nativeDb.logTxnError(error.fatal);\n }\n\n /** Determine whether any fatal validation errors have occurred during dependency propagation. */\n public get hasFatalError(): boolean { return this._nativeDb.hasFatalTxnError(); }\n\n /** @internal */\n public readonly onEndValidation = new BeEvent<() => void>();\n\n /** Called after validation completes from [[IModelDb.saveChanges]].\n * The argument to the event holds the list of elements that were inserted, updated, and deleted.\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.\n */\n public readonly onElementsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\n\n /** Called after validation completes from [[IModelDb.saveChanges]].\n * The argument to the event holds the list of models that were inserted, updated, and deleted.\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.\n */\n public readonly onModelsChanged = new BeEvent<(changes: TxnChangedEntities) => void>();\n\n /** Event raised after the geometry within one or more [[GeometricModel]]s is modified by applying a changeset or validation of a transaction.\n * A model's geometry can change as a result of:\n * - Insertion or deletion of a geometric element within the model; or\n * - Modification of an existing element's geometric properties; or\n * - An explicit request to flag it as changed via [[IModelDb.Models.updateModel]].\n */\n public readonly onModelGeometryChanged = new BeEvent<(changes: ReadonlyArray<ModelIdAndGeometryGuid>) => void>();\n\n public readonly onGeometryChanged = new BeEvent<(models: ModelGeometryChangesProps[]) => void>();\n /** Event raised before a commit operation is performed. Initiated by a call to [[IModelDb.saveChanges]], unless there are no changes to save. */\n public readonly onCommit = new BeEvent<() => void>();\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. */\n public readonly onCommitted = new BeEvent<() => void>();\n /** Event raised after a ChangeSet has been applied to this briefcase */\n public readonly onChangesApplied = new BeEvent<() => void>();\n /** Event raised before an undo/redo operation is performed. */\n public readonly onBeforeUndoRedo = new BeEvent<(isUndo: boolean) => void>();\n /** Event raised after an undo/redo operation has been performed.\n * @param _action The action that was performed.\n */\n public readonly onAfterUndoRedo = new BeEvent<(isUndo: boolean) => void>();\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.\n * @see [[onReplayedExternalTxns]] for the event raised after all such changes have been applied.\n */\n public readonly onReplayExternalTxns = new BeEvent<() => void>();\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.\n * @see [[onReplayExternalTxns]] for the event raised before the changes are applied.\n */\n public readonly onReplayedExternalTxns = new BeEvent<() => void>();\n\n /** @internal */\n public readonly onRebaseTxnBegin = new BeEvent<(txn: TxnArgs) => void>();\n /** @internal */\n public readonly onRebaseTxnEnd = new BeEvent<(txn: TxnArgs) => void>();\n /**\n * if handler is set and it does not return undefiend then default handler will not be called\n * @internal\n * */\n public appCustomConflictHandler?: (args: DbRebaseChangesetConflictArgs) => DbConflictResolution | undefined;\n\n /**\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\n * and reopened.)\n * @note This can be quite disconcerting to the user expecting to be able to undo previously made changes. It should only be used\n * under extreme circumstances where damage to the file or session could happen if the currently committed are reversed. Use sparingly and with care.\n * Probably a good idea to alert the user it happened.\n */\n public restartSession() {\n this._nativeDb.restartTxnSession();\n }\n\n /** Determine whether current txn is propagating indirect changes or not. */\n public get isIndirectChanges(): boolean { return this._nativeDb.isIndirectChanges(); }\n\n /** Determine if there are currently any reversible (undoable) changes from this editing session. */\n public get isUndoPossible(): boolean { return this._nativeDb.isUndoPossible(); }\n\n /** Determine if there are currently any reinstatable (redoable) changes */\n public get isRedoPossible(): boolean { return this._nativeDb.isRedoPossible(); }\n\n /** Get the description of the operation that would be reversed by calling reverseTxns(1).\n * This is useful for showing the operation that would be undone, for example in a menu.\n */\n public getUndoString(): string { return this._nativeDb.getUndoString(); }\n\n /** Get a description of the operation that would be reinstated by calling reinstateTxn.\n * This is useful for showing the operation that would be redone, in a pull-down menu for example.\n */\n public getRedoString(): string { return this._nativeDb.getRedoString(); }\n\n /** Begin a new multi-Txn operation. This can be used to cause a series of Txns that would normally\n * be considered separate actions for undo to be grouped into a single undoable operation. This means that when reverseTxns(1) is called,\n * the entire group of changes are undone together. Multi-Txn operations can be nested and until the outermost operation is closed\n * all changes constitute a single operation.\n * @note This method must always be paired with a call to endMultiTxnAction.\n */\n public beginMultiTxnOperation(): DbResult { return this._nativeDb.beginMultiTxnOperation(); }\n\n /** End a multi-Txn operation */\n public endMultiTxnOperation(): DbResult { return this._nativeDb.endMultiTxnOperation(); }\n\n /** Return the depth of the multi-Txn stack. Generally for diagnostic use only. */\n public getMultiTxnOperationDepth(): number { return this._nativeDb.getMultiTxnOperationDepth(); }\n\n /** Reverse (undo) the most recent operation(s) to this IModelDb.\n * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will\n * be reinstated together when/if ReinstateTxn is called.\n * @note If there are any outstanding uncommitted changes, they are reversed.\n * @note The term \"operation\" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,\n * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.\n * @note If numOperations is too large only the operations are reversible are reversed.\n */\n public reverseTxns(numOperations: number): IModelStatus {\n return this._nativeDb.reverseTxns(numOperations);\n }\n\n /** Reverse the most recent operation. */\n public reverseSingleTxn(): IModelStatus { return this.reverseTxns(1); }\n\n /** Reverse all changes back to the beginning of the session. */\n public reverseAll(): IModelStatus { return this._nativeDb.reverseAll(); }\n\n /** Reverse all changes back to a previously saved TxnId.\n * @param txnId a TxnId obtained from a previous call to GetCurrentTxnId.\n * @returns Success if the transactions were reversed, error status otherwise.\n * @see [[getCurrentTxnId]] [[cancelTo]]\n */\n public reverseTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.reverseTo(txnId); }\n\n /** Reverse and then cancel (make non-reinstatable) all changes back to a previous TxnId.\n * @param txnId a TxnId obtained from a previous call to [[getCurrentTxnId]]\n * @returns Success if the transactions were reversed and cleared, error status otherwise.\n */\n public cancelTo(txnId: TxnIdString): IModelStatus { return this._nativeDb.cancelTo(txnId); }\n\n /** Reinstate the most recently reversed transaction. Since at any time multiple transactions can be reversed, it\n * may take multiple calls to this method to reinstate all reversed operations.\n * @returns Success if a reversed transaction was reinstated, error status otherwise.\n * @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.\n */\n public reinstateTxn(): IModelStatus { return this._iModel.reinstateTxn(); }\n\n /** Get the Id of the first transaction, if any.\n */\n public queryFirstTxnId(): TxnIdString { return this._nativeDb.queryFirstTxnId(); }\n\n /** Get the successor of the specified TxnId */\n public queryNextTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryNextTxnId(txnId); }\n\n /** Get the predecessor of the specified TxnId */\n public queryPreviousTxnId(txnId: TxnIdString): TxnIdString { return this._nativeDb.queryPreviousTxnId(txnId); }\n\n /** Get the Id of the current (tip) transaction. */\n public getCurrentTxnId(): TxnIdString { return this._nativeDb.getCurrentTxnId(); }\n\n /** Get the description that was supplied when the specified transaction was saved. */\n public getTxnDescription(txnId: TxnIdString): string { return this._nativeDb.getTxnDescription(txnId); }\n\n /** Test if a TxnId is valid */\n public isTxnIdValid(txnId: TxnIdString): boolean { return this._nativeDb.isTxnIdValid(txnId); }\n\n /** Query if there are any pending Txns in this IModelDb that are waiting to be pushed. */\n public get hasPendingTxns(): boolean { return this._nativeDb.hasPendingTxns(); }\n\n /** Query if there are any changes in memory that have yet to be saved to the IModelDb. */\n public get hasUnsavedChanges(): boolean { return this._nativeDb.hasUnsavedChanges(); }\n\n /** Query if there are un-saved or un-pushed local changes. */\n public get hasLocalChanges(): boolean { return this.hasUnsavedChanges || this.hasPendingTxns; }\n\n /** Destroy the record of all local changes that have yet to be saved and/or pushed.\n * This permanently eradicates your changes - use with caution!\n * Typically, callers will want to subsequently use [[LockControl.releaseAllLocks]].\n * After calling this function, [[hasLocalChanges]], [[hasPendingTxns]], and [[hasUnsavedChanges]] will all be `false`.\n */\n public deleteAllTxns(): void {\n this._nativeDb.deleteAllTxns();\n }\n\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.\n * @beta\n */\n public queryLocalChanges(args?: QueryLocalChangesArgs): Iterable<ChangeInstanceKey> {\n if (!args) {\n args = { includedClasses: [], includeUnsavedChanges: false };\n }\n return this._nativeDb.getLocalChanges(args.includedClasses ?? [], args.includeUnsavedChanges ?? false);\n }\n\n /** Query the number of bytes of memory currently allocated by SQLite to keep track of\n * changes to the iModel, for debugging/diagnostic purposes, as reported by [sqlite3session_memory_used](https://www.sqlite.org/session/sqlite3session_memory_used.html).\n */\n public getChangeTrackingMemoryUsed(): number {\n return this._iModel[_nativeDb].getChangeTrackingMemoryUsed();\n }\n}\n\n"]}
@@ -33,6 +33,7 @@ export * from "./FontFile";
33
33
  export * from "./GeoCoordConfig";
34
34
  export * from "./GeographicCRSServices";
35
35
  export * from "./HubMock";
36
+ export * from "./ImageSourceConversion";
36
37
  export * from "./IModelCloneContext";
37
38
  export * from "./IModelDb";
38
39
  export * from "./IModelDbFonts";
@@ -117,6 +118,10 @@ export * from "./internal/cross-package";
117
118
  * @docs-group-description HubAccess
118
119
  * APIs for working with IModelHub
119
120
  */
121
+ /**
122
+ * @docs-group-description Images
123
+ * APIs for encoding and decoding images
124
+ */
120
125
  /**
121
126
  * @docs-group-description IModelHost
122
127
  * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).
@@ -1 +1 @@
1
- {"version":3,"file":"core-backend.d.ts","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":"AAKA,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,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAA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;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG"}
@@ -54,6 +54,7 @@ __exportStar(require("./FontFile"), exports);
54
54
  __exportStar(require("./GeoCoordConfig"), exports);
55
55
  __exportStar(require("./GeographicCRSServices"), exports);
56
56
  __exportStar(require("./HubMock"), exports);
57
+ __exportStar(require("./ImageSourceConversion"), exports);
57
58
  __exportStar(require("./IModelCloneContext"), exports);
58
59
  __exportStar(require("./IModelDb"), exports);
59
60
  __exportStar(require("./IModelDbFonts"), exports);
@@ -140,6 +141,10 @@ __exportStar(require("./internal/cross-package"), exports);
140
141
  * @docs-group-description HubAccess
141
142
  * APIs for working with IModelHub
142
143
  */
144
+ /**
145
+ * @docs-group-description Images
146
+ * APIs for encoding and decoding images
147
+ */
143
148
  /**
144
149
  * @docs-group-description IModelHost
145
150
  * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).
@@ -1 +1 @@
1
- {"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,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,6CAA2B;AAC3B,mDAAiC;AACjC,0DAAwC;AACxC,4CAA0B;AAC1B,uDAAqC;AACrC,6CAA2B;AAC3B,kDAAgC;AAChC,8DAA4C;AAC5C,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B;AAC7B,4CAA0B;AAC1B,8CAA4B;AAC5B,qDAAmC;AACnC,6CAA2B;AAC3B,gDAA8B;AAC9B,6CAA2B;AAC3B,0CAAwB;AACxB,qDAAmC;AACnC,+CAA6B;AAC7B,2DAAyC;AACzC,kDAAgC;AAChC,iDAA+B;AAC/B,gDAA8B;AAC9B,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,6CAA2B;AAC3B,oDAAkC;AAClC,0DAAwC;AACxC,+DAKgC;AAJ9B,8HAAA,sBAAsB,OAAA;AACtB,oIAAA,4BAA4B,OAAA;AAI9B,2DAAyC;AACzC,4CAA0B;AAC1B,gDAA8B;AAC9B,+CAA6B;AAC7B,mDAAiC;AACjC,8CAA4B;AAC5B,uDAAqC;AACrC,8DAA4C;AAC5C,wDAAsC;AACtC,8DAA4C;AAC5C,0DAAwC;AACxC,uDAAqC;AAErC,2DAAyC;AAEzC;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;IAGI;AAEJ;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nexport * from \"./BackendHubAccess\";\nexport * from \"./BackendLoggerCategory\";\nexport * from \"./BisCoreSchema\";\nexport * from \"./BlobContainerService\";\nexport * from \"./BriefcaseManager\";\nexport * from \"./Category\";\nexport * from \"./ChangedElementsDb\";\nexport * from \"./ChangeSummaryManager\";\nexport * from \"./ChannelControl\";\nexport * from \"./CheckpointManager\";\nexport * from \"./ClassRegistry\";\nexport * from \"./CloudSqlite\";\nexport * from \"./CodeService\";\nexport * from \"./CodeSpecs\";\nexport * from \"./DevTools\";\nexport * from \"./DisplayStyle\";\nexport * from \"./domains/FunctionalElements\";\nexport * from \"./domains/FunctionalSchema\";\nexport * from \"./domains/GenericElements\";\nexport * from \"./domains/GenericSchema\";\nexport * from \"./ECDb\";\nexport * from \"./ECSchemaXmlContext\";\nexport * from \"./ECSqlStatement\";\nexport * from \"./Element\";\nexport * from \"./ElementAspect\";\nexport * from \"./ElementGraphics\";\nexport * from \"./ElementTreeWalker\";\nexport * from \"./Entity\";\nexport * from \"./EntityReferences\";\nexport * from \"./ExportGraphics\";\nexport * from \"./ExternalSource\";\nexport * from \"./FontFile\";\nexport * from \"./GeoCoordConfig\";\nexport * from \"./GeographicCRSServices\";\nexport * from \"./HubMock\";\nexport * from \"./IModelCloneContext\";\nexport * from \"./IModelDb\";\nexport * from \"./IModelDbFonts\";\nexport * from \"./IModelElementCloneContext\";\nexport * from \"./IModelHost\";\nexport * from \"./IModelJsFs\";\nexport * from \"./SchemaSync\";\nexport * from \"./IpcHost\";\nexport * from \"./LineStyle\";\nexport * from \"./LocalhostIpcHost\";\nexport * from \"./LocalHub\";\nexport * from \"./LockControl\";\nexport * from \"./Material\";\nexport * from \"./Model\";\nexport * from \"./NativeAppStorage\";\nexport * from \"./NativeHost\";\nexport * from \"./NavigationRelationship\";\nexport * from \"./PropertyStore\";\nexport * from \"./Relationship\";\nexport * from \"./rpc/tracing\";\nexport * from \"./Schema\";\nexport * from \"./SchemaUtils\";\nexport * from \"./SheetIndex\";\nexport * from \"./SQLiteDb\";\nexport * from \"./SqliteStatement\";\nexport * from \"./TextAnnotationElement\";\nexport {\n computeGraphemeOffsets,\n computeLayoutTextBlockResult,\n ComputeGraphemeOffsetsArgs,\n LayoutTextBlockArgs,\n} from \"./TextAnnotationLayout\";\nexport * from \"./TextAnnotationGeometry\";\nexport * from \"./Texture\";\nexport * from \"./TileStorage\";\nexport * from \"./TxnManager\";\nexport * from \"./ViewDefinition\";\nexport * from \"./ViewStore\";\nexport * from \"./workspace/Settings\";\nexport * from \"./workspace/SettingsSchemas\";\nexport * from \"./workspace/Workspace\";\nexport * from \"./workspace/WorkspaceEditor\";\nexport * from \"./SqliteChangesetReader\";\nexport * from \"./ChangesetECAdaptor\";\n\nexport * from \"./internal/cross-package\";\n\n/** @docs-package-description\n * The core-backend package always runs on the computer with a local Briefcase.\n *\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\n */\n\n/**\n * @docs-group-description BlobContainers\n * Classes for working with cloud-based blob containers.\n */\n\n/**\n * @docs-group-description Codes\n * Classes for working with [Codes]($docs/BIS/guide/fundamentals/codes.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ECDb\n * Classes for working with ECDb.\n */\n\n/**\n * @docs-group-description ECSQL\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\n */\n\n/**\n * @docs-group-description ElementAspects\n * Subclasses of [ElementAspects]($docs/bis/guide/fundamentals/elementaspect-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ElementGeometry\n * Classes for defining the symbology and geometry of geometric elements\n */\n\n/**\n * @docs-group-description Elements\n * Subclasses of [Elements]($docs/BIS/guide/fundamentals/element-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ExportGraphics\n * APIs for producing low-level graphics primitives from element geometry.\n */\n\n/**\n * @docs-group-description HubAccess\n * APIs for working with IModelHub\n */\n\n/**\n * @docs-group-description IModelHost\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\n * See [the learning article]($docs/learning/backend/IModelHost.md).\n */\n\n/**\n * @docs-group-description iModels\n * Classes for working with [iModels]($docs/learning/iModels.md).\n * See [the learning article]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description Logging\n * Logger categories used by this package.\n */\n\n/**\n * @docs-group-description Models\n * Subclasses of [Models]($docs/BIS/guide/fundamentals/model-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description NativeApp\n * Classes for working with Mobile/Desktop Application.\n */\n\n/**\n * @docs-group-description Portability\n */\n\n/**\n * @docs-group-description Relationships\n * Classes that describe the [relationships]($docs/bis/guide/fundamentals/relationship-fundamentals.md) between elements.\n */\n\n/**\n * @docs-group-description RpcInterface\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\n */\n\n/**\n * @docs-group-description Schema\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\n */\n\n/**\n * @docs-group-description SQLite\n * Classes for working directly with SQLite\n */\n\n/**\n * @docs-group-description SQLiteDb\n * Classes for working with SQLiteDb.\n */\n\n/**\n * @docs-group-description TileStorage\n * Class for working with cloud storage using iTwin/object-storage cloud providers\n */\n\n/**\n * @docs-group-description ViewDefinitions\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\n */\n\n/**\n * @docs-group-description Workspace\n * APIs for loading and using Settings and Workspace resources\n */\n"]}
1
+ {"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,qDAAmC;AACnC,0DAAwC;AACxC,kDAAgC;AAChC,yDAAuC;AACvC,qDAAmC;AACnC,6CAA2B;AAC3B,sDAAoC;AACpC,yDAAuC;AACvC,mDAAiC;AACjC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;;;;GAIG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nexport * from \"./BackendHubAccess\";\nexport * from \"./BackendLoggerCategory\";\nexport * from \"./BisCoreSchema\";\nexport * from \"./BlobContainerService\";\nexport * from \"./BriefcaseManager\";\nexport * from \"./Category\";\nexport * from \"./ChangedElementsDb\";\nexport * from \"./ChangeSummaryManager\";\nexport * from \"./ChannelControl\";\nexport * from \"./CheckpointManager\";\nexport * from \"./ClassRegistry\";\nexport * from \"./CloudSqlite\";\nexport * from \"./CodeService\";\nexport * from \"./CodeSpecs\";\nexport * from \"./DevTools\";\nexport * from \"./DisplayStyle\";\nexport * from \"./domains/FunctionalElements\";\nexport * from \"./domains/FunctionalSchema\";\nexport * from \"./domains/GenericElements\";\nexport * from \"./domains/GenericSchema\";\nexport * from \"./ECDb\";\nexport * from \"./ECSchemaXmlContext\";\nexport * from \"./ECSqlStatement\";\nexport * from \"./Element\";\nexport * from \"./ElementAspect\";\nexport * from \"./ElementGraphics\";\nexport * from \"./ElementTreeWalker\";\nexport * from \"./Entity\";\nexport * from \"./EntityReferences\";\nexport * from \"./ExportGraphics\";\nexport * from \"./ExternalSource\";\nexport * from \"./FontFile\";\nexport * from \"./GeoCoordConfig\";\nexport * from \"./GeographicCRSServices\";\nexport * from \"./HubMock\";\nexport * from \"./ImageSourceConversion\";\nexport * from \"./IModelCloneContext\";\nexport * from \"./IModelDb\";\nexport * from \"./IModelDbFonts\";\nexport * from \"./IModelElementCloneContext\";\nexport * from \"./IModelHost\";\nexport * from \"./IModelJsFs\";\nexport * from \"./SchemaSync\";\nexport * from \"./IpcHost\";\nexport * from \"./LineStyle\";\nexport * from \"./LocalhostIpcHost\";\nexport * from \"./LocalHub\";\nexport * from \"./LockControl\";\nexport * from \"./Material\";\nexport * from \"./Model\";\nexport * from \"./NativeAppStorage\";\nexport * from \"./NativeHost\";\nexport * from \"./NavigationRelationship\";\nexport * from \"./PropertyStore\";\nexport * from \"./Relationship\";\nexport * from \"./rpc/tracing\";\nexport * from \"./Schema\";\nexport * from \"./SchemaUtils\";\nexport * from \"./SheetIndex\";\nexport * from \"./SQLiteDb\";\nexport * from \"./SqliteStatement\";\nexport * from \"./TextAnnotationElement\";\nexport {\n computeGraphemeOffsets,\n computeLayoutTextBlockResult,\n ComputeGraphemeOffsetsArgs,\n LayoutTextBlockArgs,\n} from \"./TextAnnotationLayout\";\nexport * from \"./TextAnnotationGeometry\";\nexport * from \"./Texture\";\nexport * from \"./TileStorage\";\nexport * from \"./TxnManager\";\nexport * from \"./ViewDefinition\";\nexport * from \"./ViewStore\";\nexport * from \"./workspace/Settings\";\nexport * from \"./workspace/SettingsSchemas\";\nexport * from \"./workspace/Workspace\";\nexport * from \"./workspace/WorkspaceEditor\";\nexport * from \"./SqliteChangesetReader\";\nexport * from \"./ChangesetECAdaptor\";\n\nexport * from \"./internal/cross-package\";\n\n/** @docs-package-description\n * The core-backend package always runs on the computer with a local Briefcase.\n *\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\n */\n\n/**\n * @docs-group-description BlobContainers\n * Classes for working with cloud-based blob containers.\n */\n\n/**\n * @docs-group-description Codes\n * Classes for working with [Codes]($docs/BIS/guide/fundamentals/codes.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ECDb\n * Classes for working with ECDb.\n */\n\n/**\n * @docs-group-description ECSQL\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\n */\n\n/**\n * @docs-group-description ElementAspects\n * Subclasses of [ElementAspects]($docs/bis/guide/fundamentals/elementaspect-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ElementGeometry\n * Classes for defining the symbology and geometry of geometric elements\n */\n\n/**\n * @docs-group-description Elements\n * Subclasses of [Elements]($docs/BIS/guide/fundamentals/element-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ExportGraphics\n * APIs for producing low-level graphics primitives from element geometry.\n */\n\n/**\n * @docs-group-description HubAccess\n * APIs for working with IModelHub\n */\n\n/**\n * @docs-group-description Images\n * APIs for encoding and decoding images\n */\n\n/**\n * @docs-group-description IModelHost\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\n * See [the learning article]($docs/learning/backend/IModelHost.md).\n */\n\n/**\n * @docs-group-description iModels\n * Classes for working with [iModels]($docs/learning/iModels.md).\n * See [the learning article]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description Logging\n * Logger categories used by this package.\n */\n\n/**\n * @docs-group-description Models\n * Subclasses of [Models]($docs/BIS/guide/fundamentals/model-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description NativeApp\n * Classes for working with Mobile/Desktop Application.\n */\n\n/**\n * @docs-group-description Portability\n */\n\n/**\n * @docs-group-description Relationships\n * Classes that describe the [relationships]($docs/bis/guide/fundamentals/relationship-fundamentals.md) between elements.\n */\n\n/**\n * @docs-group-description RpcInterface\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\n */\n\n/**\n * @docs-group-description Schema\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\n */\n\n/**\n * @docs-group-description SQLite\n * Classes for working directly with SQLite\n */\n\n/**\n * @docs-group-description SQLiteDb\n * Classes for working with SQLiteDb.\n */\n\n/**\n * @docs-group-description TileStorage\n * Class for working with cloud storage using iTwin/object-storage cloud providers\n */\n\n/**\n * @docs-group-description ViewDefinitions\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\n */\n\n/**\n * @docs-group-description Workspace\n * APIs for loading and using Settings and Workspace resources\n */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ServerBasedLocks.d.ts","sourceRoot":"","sources":["../../../src/internal/ServerBasedLocks.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAkB,OAAO,EAAE,UAAU,EAA0B,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAAuB,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,yBAAyB,EAAa,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAmB/G,qBAAa,gBAAiB,YAAW,WAAW;IAClD,SAAgB,CAAC,yBAAyB,CAAC,YAAa;IAExD,IAAW,aAAa,YAAmB;IAC3C,SAAS,CAAC,QAAQ,CAAC,MAAM,WAAkB;IAC3C,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;gBAEvB,MAAM,EAAE,WAAW;IAY/B,CAAC,MAAM,CAAC;IAKf,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,YAAY;IAOpB;;OAEG;IACH,OAAO,CAAC,aAAa;IAKrB,qBAAqB;IACd,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAQhC,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAKnC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ7C,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,uBAAuB;IAgB/B,mGAAmG;IAC5F,kBAAkB,CAAC,EAAE,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AM,EAAE,WAAW,GAAG,WAAW,CAEvE"}
@@ -66,7 +66,7 @@ class ServerBasedLocks {
66
66
  });
67
67
  }
68
68
  async [Symbols_1._releaseAllLocks]() {
69
- await IModelHost_1.IModelHost.hubAccess.releaseAllLocks(this.briefcase); // throws if unsuccessful
69
+ await IModelHost_1.IModelHost[Symbols_1._hubAccess].releaseAllLocks(this.briefcase); // throws if unsuccessful
70
70
  this.clearAllLocks();
71
71
  }
72
72
  async releaseAllLocks() {
@@ -134,7 +134,7 @@ class ServerBasedLocks {
134
134
  if (!locks.has(shared)) // we may already be asking for exclusive lock
135
135
  locks.set(shared, core_common_1.LockState.Shared);
136
136
  }
137
- await IModelHost_1.IModelHost.hubAccess.acquireLocks(this.briefcase, locks); // throws if unsuccessful
137
+ await IModelHost_1.IModelHost[Symbols_1._hubAccess].acquireLocks(this.briefcase, locks); // throws if unsuccessful
138
138
  for (const lock of locks)
139
139
  this.insertLock(lock[0], lock[1], 0 /* LockOrigin.Acquired */);
140
140
  this.lockDb.saveChanges();
@@ -1 +1 @@
1
- {"version":3,"file":"ServerBasedLocks.js","sourceRoot":"","sources":["../../../src/internal/ServerBasedLocks.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AA8N/F,wDAEC;AA9ND;;GAEG;AAEH,sDAAkG;AAClG,oDAAoE;AAIpE,8CAA2C;AAC3C,0CAAuC;AACvC,uCAA+G;AAmB/G,MAAa,gBAAgB;IACX,CAAC,mCAAyB,CAAC,GAAG,SAAS,CAAC;IAExD,IAAW,aAAa,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IACxB,MAAM,GAAG,IAAI,mBAAQ,EAAE,CAAC;IACxB,SAAS,CAAc;IAE1C,YAAmB,MAAmB;QACpC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,mBAAS,CAAC,CAAC,mBAAmB,EAAE,QAAQ,CAAC;QAClE,IAAI,CAAC;YACH,IAAI,CAAC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,CAAC,SAAS,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,wGAAwG;IACjG,CAAC,4BAAkB,CAAC,CAAC,EAAc;QACxC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,uBAAS,CAAC,SAAS,gCAAwB,CAAC;QAChE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;IAED,yDAAyD;IACzD,IAAY,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAElF,uGAAuG;IAChG,kBAAkB,CAAC,EAAc,EAAE,IAAY,EAAE,SAAiB;QACvE,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACxD,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,WAAW,EAAE,8BAA8B,IAAI,QAAQ,SAAS,QAAQ,EAAE,GAAG,CAAC,CAAC;IACtH,CAAC;IAED,kGAAkG;IAC3F,eAAe,CAAC,EAAc,EAAE,IAAY,EAAE,SAAiB;QACpE,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,WAAW,EAAE,2BAA2B,IAAI,QAAQ,SAAS,QAAQ,EAAE,GAAG,CAAC,CAAC;IACnH,CAAC;CAEF;AA5LD,4CA4LC;AAED,SAAgB,sBAAsB,CAAC,MAAmB;IACxD,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module iModels\n */\n\nimport { DbResult, Id64, Id64Arg, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport { IModel, IModelError, LockState } from \"@itwin/core-common\";\nimport { LockMap } from \"../BackendHubAccess\";\nimport { BriefcaseDb } from \"../IModelDb\";\nimport { LockControl } from \"../LockControl\";\nimport { IModelHost } from \"../IModelHost\";\nimport { SQLiteDb } from \"../SQLiteDb\";\nimport { _close, _elementWasCreated, _implementationProhibited, _nativeDb, _releaseAllLocks } from \"./Symbols\";\n\n/**\n * Both the Model and Parent of an element are considered \"owners\" of their member elements. That means:\n * 1) they must hold at least a shared lock before an exclusive lock can be acquired for their members\n * 2) if they hold an exclusive lock, then all of their members are exclusively locked implicitly.\n */\ninterface ElementOwners {\n readonly modelId: Id64String;\n readonly parentId: Id64String | undefined;\n}\n\n// eslint-disable-next-line no-restricted-syntax\nconst enum LockOrigin {\n Acquired = 0,\n NewElement = 1,\n Discovered = 2,\n}\n\nexport class ServerBasedLocks implements LockControl {\n public readonly [_implementationProhibited] = undefined;\n\n public get isServerBased() { return true; }\n protected readonly lockDb = new SQLiteDb();\n protected readonly briefcase: BriefcaseDb;\n\n public constructor(iModel: BriefcaseDb) {\n this.briefcase = iModel;\n const dbName = `${iModel[_nativeDb].getTempFileBaseName()}-locks`;\n try {\n this.lockDb.openDb(dbName, OpenMode.ReadWrite);\n } catch {\n this.lockDb.createDb(dbName);\n this.lockDb.executeSQL(\"CREATE TABLE locks(id INTEGER PRIMARY KEY NOT NULL,state INTEGER NOT NULL,origin INTEGER)\");\n this.lockDb.saveChanges();\n }\n }\n\n public [_close]() {\n if (this.lockDb.isOpen)\n this.lockDb.closeDb();\n }\n\n private getOwners(id: Id64String): ElementOwners {\n return this.briefcase.withPreparedSqliteStatement(\"SELECT ModelId,ParentId FROM bis_Element WHERE id=?\", (stmt) => {\n stmt.bindId(1, id);\n const rc = stmt.step();\n if (DbResult.BE_SQLITE_ROW !== rc)\n throw new IModelError(rc, `element ${id} not found`);\n\n return { modelId: stmt.getValueId(0), parentId: stmt.getValueId(1) };\n });\n }\n\n private getLockState(id?: Id64String): LockState | undefined {\n return (id === undefined || !Id64.isValid(id)) ? undefined : this.lockDb.withPreparedSqliteStatement(\"SELECT state FROM locks WHERE id=?\", (stmt) => {\n stmt.bindId(1, id);\n return (DbResult.BE_SQLITE_ROW === stmt.step()) ? stmt.getValueInteger(0) : undefined;\n });\n }\n\n /** Clear the cache of locally held locks.\n * Note: does *not* release locks from server.\n */\n private clearAllLocks() {\n this.lockDb.executeSQL(\"DELETE FROM locks\");\n this.lockDb.saveChanges();\n }\n\n /** only for tests */\n public getLockCount(state: LockState): number {\n return this.lockDb.withSqliteStatement(\"SELECT count(*) FROM locks WHERE state=?\", (stmt) => {\n stmt.bindInteger(1, state);\n stmt.step();\n return stmt.getValueInteger(0);\n });\n }\n\n public async [_releaseAllLocks](): Promise<void> {\n await IModelHost.hubAccess.releaseAllLocks(this.briefcase); // throws if unsuccessful\n this.clearAllLocks();\n }\n\n public async releaseAllLocks(): Promise<void> {\n if (this.briefcase.txns.hasLocalChanges) {\n throw new Error(\"Locks cannot be released while the briefcase contains local changes\");\n }\n\n return this[_releaseAllLocks]();\n }\n\n private insertLock(id: Id64String, state: LockState, origin: LockOrigin): true {\n this.lockDb.withPreparedSqliteStatement(\"INSERT INTO locks(id,state,origin) VALUES (?,?,?) ON CONFLICT(id) DO UPDATE SET state=excluded.state,origin=excluded.origin\", (stmt) => {\n stmt.bindId(1, id);\n stmt.bindInteger(2, state);\n stmt.bindInteger(3, origin);\n const rc = stmt.step();\n if (DbResult.BE_SQLITE_DONE !== rc)\n throw new IModelError(rc, \"can't insert lock into database\");\n });\n return true;\n }\n\n private ownerHoldsExclusiveLock(id: Id64String | undefined): boolean {\n if (id === undefined || id === IModel.rootSubjectId)\n return false; // has no owners\n\n const { modelId, parentId } = this.getOwners(id);\n if (this.getLockState(modelId) === LockState.Exclusive || this.getLockState(parentId) === LockState.Exclusive)\n return true;\n\n // see if this model is exclusively locked by one of its owners. If so, save that fact on modelId so future tests won't have to descend.\n if (this.ownerHoldsExclusiveLock(modelId))\n return this.insertLock(modelId, LockState.Exclusive, LockOrigin.Discovered);\n\n // see if the parent is exclusively locked by one of its owners. If so, save that fact on parentId so future tests won't have to descend.\n return this.ownerHoldsExclusiveLock(parentId) ? this.insertLock(parentId!, LockState.Exclusive, LockOrigin.Discovered) : false; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n }\n\n /** Determine whether an the exclusive lock is already held by an element (or one of its owners) */\n public holdsExclusiveLock(id: Id64String): boolean {\n // see if we hold the exclusive lock. or if one of the element's owners is exclusively locked (recursively)\n return this.getLockState(id) === LockState.Exclusive || this.ownerHoldsExclusiveLock(id);\n }\n\n public holdsSharedLock(id: Id64String): boolean {\n const state = this.getLockState(id);\n // see if we hold shared or exclusive lock, or if an owner has exclusive lock. If so we implicitly have shared lock, but owner holding shared lock doesn't help.\n return (state === LockState.Shared || state === LockState.Exclusive) || this.ownerHoldsExclusiveLock(id);\n }\n\n /** if the shared lock on the element supplied is not already held, add it to the set of shared locks required. Then, check owners. */\n private addSharedLock(id: Id64String | undefined, locks: Set<Id64String>) {\n // if the id is not valid, or of the lock is already in the set, or if we already hold a shared lock, we're done\n // Note: if we hold a shared lock, it is guaranteed that we also hold all required shared locks on owners.\n if (id === undefined || !Id64.isValid(id) || locks.has(id) || this.holdsSharedLock(id))\n return;\n\n locks.add(id); // add to set of needed shared locks\n this.addOwnerSharedLocks(id, locks); // check parent models and groups\n }\n\n /** add owners (recursively) of an element to a list of required shared locks, if not already held. */\n private addOwnerSharedLocks(id: Id64String, locks: Set<Id64String>) {\n const el = this.getOwners(id);\n this.addSharedLock(el.parentId, locks); // if this element is in a group\n this.addSharedLock(el.modelId, locks); // check its model\n }\n\n /** attempt to acquire all necessary locks for a set of elements */\n private async acquireAllLocks(locks: LockMap) {\n if (locks.size === 0) // no locks are required.\n return;\n\n const sharedLocks = new Set<Id64String>();\n for (const lock of locks)\n this.addOwnerSharedLocks(lock[0], sharedLocks);\n\n for (const shared of sharedLocks) {\n if (!locks.has(shared)) // we may already be asking for exclusive lock\n locks.set(shared, LockState.Shared);\n }\n\n await IModelHost.hubAccess.acquireLocks(this.briefcase, locks); // throws if unsuccessful\n for (const lock of locks)\n this.insertLock(lock[0], lock[1], LockOrigin.Acquired);\n this.lockDb.saveChanges();\n }\n\n public async acquireLocks(arg: { shared?: Id64Arg, exclusive?: Id64Arg }): Promise<void> {\n const locks = new Map<Id64String, LockState>();\n if (arg.shared) {\n for (const id of Id64.iterable(arg.shared)) {\n if (!this.holdsSharedLock(id))\n locks.set(id, LockState.Shared);\n }\n }\n if (arg.exclusive) {\n for (const id of Id64.iterable(arg.exclusive)) {\n if (!this.holdsExclusiveLock(id))\n locks.set(id, LockState.Exclusive);\n }\n }\n return this.acquireAllLocks(locks);\n }\n\n /** When an element is newly created in a session, we hold the lock on it implicitly. Save that fact. */\n public [_elementWasCreated](id: Id64String) {\n this.insertLock(id, LockState.Exclusive, LockOrigin.NewElement);\n this.lockDb.saveChanges();\n }\n\n /** locks are not necessary during change propagation. */\n private get _locksAreRequired() { return !this.briefcase.txns.isIndirectChanges; }\n\n /** throw if locks are currently required and the exclusive lock is not held on the supplied element */\n public checkExclusiveLock(id: Id64String, type: string, operation: string) {\n if (this._locksAreRequired && !this.holdsExclusiveLock(id))\n throw new IModelError(IModelStatus.LockNotHeld, `exclusive lock not held on ${type} for ${operation} (id=${id})`);\n }\n\n /** throw if locks are currently required and a shared lock is not held on the supplied element */\n public checkSharedLock(id: Id64String, type: string, operation: string) {\n if (this._locksAreRequired && !this.holdsSharedLock(id))\n throw new IModelError(IModelStatus.LockNotHeld, `shared lock not held on ${type} for ${operation} (id=${id})`);\n }\n\n}\n\nexport function createServerBasedLocks(iModel: BriefcaseDb): LockControl {\n return new ServerBasedLocks(iModel);\n}\n"]}
1
+ {"version":3,"file":"ServerBasedLocks.js","sourceRoot":"","sources":["../../../src/internal/ServerBasedLocks.ts"],"names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,eAAe,CAAC,EAAc,EAAE,IAAY,EAAE,SAAiB;QACpE,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,WAAW,EAAE,2BAA2B,IAAI,QAAQ,SAAS,QAAQ,EAAE,GAAG,CAAC,CAAC;IACnH,CAAC;CAEF;AA5LD,4CA4LC;AAED,SAAgB,sBAAsB,CAAC,MAAmB;IACxD,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module iModels\n */\n\nimport { DbResult, Id64, Id64Arg, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport { IModel, IModelError, LockState } from \"@itwin/core-common\";\nimport { LockMap } from \"../BackendHubAccess\";\nimport { BriefcaseDb } from \"../IModelDb\";\nimport { LockControl } from \"../LockControl\";\nimport { IModelHost } from \"../IModelHost\";\nimport { SQLiteDb } from \"../SQLiteDb\";\nimport { _close, _elementWasCreated, _hubAccess, _implementationProhibited, _nativeDb, _releaseAllLocks } from \"./Symbols\";\n\n/**\n * Both the Model and Parent of an element are considered \"owners\" of their member elements. That means:\n * 1) they must hold at least a shared lock before an exclusive lock can be acquired for their members\n * 2) if they hold an exclusive lock, then all of their members are exclusively locked implicitly.\n */\ninterface ElementOwners {\n readonly modelId: Id64String;\n readonly parentId: Id64String | undefined;\n}\n\n// eslint-disable-next-line no-restricted-syntax\nconst enum LockOrigin {\n Acquired = 0,\n NewElement = 1,\n Discovered = 2,\n}\n\nexport class ServerBasedLocks implements LockControl {\n public readonly [_implementationProhibited] = undefined;\n\n public get isServerBased() { return true; }\n protected readonly lockDb = new SQLiteDb();\n protected readonly briefcase: BriefcaseDb;\n\n public constructor(iModel: BriefcaseDb) {\n this.briefcase = iModel;\n const dbName = `${iModel[_nativeDb].getTempFileBaseName()}-locks`;\n try {\n this.lockDb.openDb(dbName, OpenMode.ReadWrite);\n } catch {\n this.lockDb.createDb(dbName);\n this.lockDb.executeSQL(\"CREATE TABLE locks(id INTEGER PRIMARY KEY NOT NULL,state INTEGER NOT NULL,origin INTEGER)\");\n this.lockDb.saveChanges();\n }\n }\n\n public [_close]() {\n if (this.lockDb.isOpen)\n this.lockDb.closeDb();\n }\n\n private getOwners(id: Id64String): ElementOwners {\n return this.briefcase.withPreparedSqliteStatement(\"SELECT ModelId,ParentId FROM bis_Element WHERE id=?\", (stmt) => {\n stmt.bindId(1, id);\n const rc = stmt.step();\n if (DbResult.BE_SQLITE_ROW !== rc)\n throw new IModelError(rc, `element ${id} not found`);\n\n return { modelId: stmt.getValueId(0), parentId: stmt.getValueId(1) };\n });\n }\n\n private getLockState(id?: Id64String): LockState | undefined {\n return (id === undefined || !Id64.isValid(id)) ? undefined : this.lockDb.withPreparedSqliteStatement(\"SELECT state FROM locks WHERE id=?\", (stmt) => {\n stmt.bindId(1, id);\n return (DbResult.BE_SQLITE_ROW === stmt.step()) ? stmt.getValueInteger(0) : undefined;\n });\n }\n\n /** Clear the cache of locally held locks.\n * Note: does *not* release locks from server.\n */\n private clearAllLocks() {\n this.lockDb.executeSQL(\"DELETE FROM locks\");\n this.lockDb.saveChanges();\n }\n\n /** only for tests */\n public getLockCount(state: LockState): number {\n return this.lockDb.withSqliteStatement(\"SELECT count(*) FROM locks WHERE state=?\", (stmt) => {\n stmt.bindInteger(1, state);\n stmt.step();\n return stmt.getValueInteger(0);\n });\n }\n\n public async [_releaseAllLocks](): Promise<void> {\n await IModelHost[_hubAccess].releaseAllLocks(this.briefcase); // throws if unsuccessful\n this.clearAllLocks();\n }\n\n public async releaseAllLocks(): Promise<void> {\n if (this.briefcase.txns.hasLocalChanges) {\n throw new Error(\"Locks cannot be released while the briefcase contains local changes\");\n }\n\n return this[_releaseAllLocks]();\n }\n\n private insertLock(id: Id64String, state: LockState, origin: LockOrigin): true {\n this.lockDb.withPreparedSqliteStatement(\"INSERT INTO locks(id,state,origin) VALUES (?,?,?) ON CONFLICT(id) DO UPDATE SET state=excluded.state,origin=excluded.origin\", (stmt) => {\n stmt.bindId(1, id);\n stmt.bindInteger(2, state);\n stmt.bindInteger(3, origin);\n const rc = stmt.step();\n if (DbResult.BE_SQLITE_DONE !== rc)\n throw new IModelError(rc, \"can't insert lock into database\");\n });\n return true;\n }\n\n private ownerHoldsExclusiveLock(id: Id64String | undefined): boolean {\n if (id === undefined || id === IModel.rootSubjectId)\n return false; // has no owners\n\n const { modelId, parentId } = this.getOwners(id);\n if (this.getLockState(modelId) === LockState.Exclusive || this.getLockState(parentId) === LockState.Exclusive)\n return true;\n\n // see if this model is exclusively locked by one of its owners. If so, save that fact on modelId so future tests won't have to descend.\n if (this.ownerHoldsExclusiveLock(modelId))\n return this.insertLock(modelId, LockState.Exclusive, LockOrigin.Discovered);\n\n // see if the parent is exclusively locked by one of its owners. If so, save that fact on parentId so future tests won't have to descend.\n return this.ownerHoldsExclusiveLock(parentId) ? this.insertLock(parentId!, LockState.Exclusive, LockOrigin.Discovered) : false; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n }\n\n /** Determine whether an the exclusive lock is already held by an element (or one of its owners) */\n public holdsExclusiveLock(id: Id64String): boolean {\n // see if we hold the exclusive lock. or if one of the element's owners is exclusively locked (recursively)\n return this.getLockState(id) === LockState.Exclusive || this.ownerHoldsExclusiveLock(id);\n }\n\n public holdsSharedLock(id: Id64String): boolean {\n const state = this.getLockState(id);\n // see if we hold shared or exclusive lock, or if an owner has exclusive lock. If so we implicitly have shared lock, but owner holding shared lock doesn't help.\n return (state === LockState.Shared || state === LockState.Exclusive) || this.ownerHoldsExclusiveLock(id);\n }\n\n /** if the shared lock on the element supplied is not already held, add it to the set of shared locks required. Then, check owners. */\n private addSharedLock(id: Id64String | undefined, locks: Set<Id64String>) {\n // if the id is not valid, or of the lock is already in the set, or if we already hold a shared lock, we're done\n // Note: if we hold a shared lock, it is guaranteed that we also hold all required shared locks on owners.\n if (id === undefined || !Id64.isValid(id) || locks.has(id) || this.holdsSharedLock(id))\n return;\n\n locks.add(id); // add to set of needed shared locks\n this.addOwnerSharedLocks(id, locks); // check parent models and groups\n }\n\n /** add owners (recursively) of an element to a list of required shared locks, if not already held. */\n private addOwnerSharedLocks(id: Id64String, locks: Set<Id64String>) {\n const el = this.getOwners(id);\n this.addSharedLock(el.parentId, locks); // if this element is in a group\n this.addSharedLock(el.modelId, locks); // check its model\n }\n\n /** attempt to acquire all necessary locks for a set of elements */\n private async acquireAllLocks(locks: LockMap) {\n if (locks.size === 0) // no locks are required.\n return;\n\n const sharedLocks = new Set<Id64String>();\n for (const lock of locks)\n this.addOwnerSharedLocks(lock[0], sharedLocks);\n\n for (const shared of sharedLocks) {\n if (!locks.has(shared)) // we may already be asking for exclusive lock\n locks.set(shared, LockState.Shared);\n }\n\n await IModelHost[_hubAccess].acquireLocks(this.briefcase, locks); // throws if unsuccessful\n for (const lock of locks)\n this.insertLock(lock[0], lock[1], LockOrigin.Acquired);\n this.lockDb.saveChanges();\n }\n\n public async acquireLocks(arg: { shared?: Id64Arg, exclusive?: Id64Arg }): Promise<void> {\n const locks = new Map<Id64String, LockState>();\n if (arg.shared) {\n for (const id of Id64.iterable(arg.shared)) {\n if (!this.holdsSharedLock(id))\n locks.set(id, LockState.Shared);\n }\n }\n if (arg.exclusive) {\n for (const id of Id64.iterable(arg.exclusive)) {\n if (!this.holdsExclusiveLock(id))\n locks.set(id, LockState.Exclusive);\n }\n }\n return this.acquireAllLocks(locks);\n }\n\n /** When an element is newly created in a session, we hold the lock on it implicitly. Save that fact. */\n public [_elementWasCreated](id: Id64String) {\n this.insertLock(id, LockState.Exclusive, LockOrigin.NewElement);\n this.lockDb.saveChanges();\n }\n\n /** locks are not necessary during change propagation. */\n private get _locksAreRequired() { return !this.briefcase.txns.isIndirectChanges; }\n\n /** throw if locks are currently required and the exclusive lock is not held on the supplied element */\n public checkExclusiveLock(id: Id64String, type: string, operation: string) {\n if (this._locksAreRequired && !this.holdsExclusiveLock(id))\n throw new IModelError(IModelStatus.LockNotHeld, `exclusive lock not held on ${type} for ${operation} (id=${id})`);\n }\n\n /** throw if locks are currently required and a shared lock is not held on the supplied element */\n public checkSharedLock(id: Id64String, type: string, operation: string) {\n if (this._locksAreRequired && !this.holdsSharedLock(id))\n throw new IModelError(IModelStatus.LockNotHeld, `shared lock not held on ${type} for ${operation} (id=${id})`);\n }\n\n}\n\nexport function createServerBasedLocks(iModel: BriefcaseDb): LockControl {\n return new ServerBasedLocks(iModel);\n}\n"]}
@@ -11,4 +11,8 @@ export declare const _key: unique symbol;
11
11
  export declare const _nativeDb: unique symbol;
12
12
  export declare const _releaseAllLocks: unique symbol;
13
13
  export declare const _verifyChannel: unique symbol;
14
+ /** @internal */
15
+ export declare const _hubAccess: unique symbol;
16
+ export declare const _setHubAccess: unique symbol;
17
+ export declare const _getHubAccess: unique symbol;
14
18
  //# sourceMappingURL=Symbols.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Symbols.d.ts","sourceRoot":"","sources":["../../../src/internal/Symbols.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,eAAO,MAAM,yBAAyB,eAAmG,CAAC;AAM1I,eAAO,MAAM,MAAM,eAA2B,CAAC;AAC/C,eAAO,MAAM,kBAAkB,eAAuC,CAAC;AACvE,eAAO,MAAM,UAAU,eAA+B,CAAC;AACvD,eAAO,MAAM,QAAQ,eAA6B,CAAC;AACnD,eAAO,MAAM,IAAI,eAAyB,CAAC;AAC3C,gBAAgB;AAChB,eAAO,MAAM,SAAS,eAA8B,CAAC;AACrD,eAAO,MAAM,gBAAgB,eAAqC,CAAC;AACnE,eAAO,MAAM,cAAc,eAAmC,CAAC"}
1
+ {"version":3,"file":"Symbols.d.ts","sourceRoot":"","sources":["../../../src/internal/Symbols.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,eAAO,MAAM,yBAAyB,eAAmG,CAAC;AAM1I,eAAO,MAAM,MAAM,eAA2B,CAAC;AAC/C,eAAO,MAAM,kBAAkB,eAAuC,CAAC;AACvE,eAAO,MAAM,UAAU,eAA+B,CAAC;AACvD,eAAO,MAAM,QAAQ,eAA6B,CAAC;AACnD,eAAO,MAAM,IAAI,eAAyB,CAAC;AAC3C,gBAAgB;AAChB,eAAO,MAAM,SAAS,eAA8B,CAAC;AACrD,eAAO,MAAM,gBAAgB,eAAqC,CAAC;AACnE,eAAO,MAAM,cAAc,eAAmC,CAAC;AAC/D,gBAAgB;AAChB,eAAO,MAAM,UAAU,eAA+B,CAAC;AACvD,eAAO,MAAM,aAAa,eAAkC,CAAC;AAC7D,eAAO,MAAM,aAAa,eAAkC,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * @module Workspace
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports._verifyChannel = exports._releaseAllLocks = exports._nativeDb = exports._key = exports._getData = exports._faceProps = exports._elementWasCreated = exports._close = exports._implementationProhibited = void 0;
10
+ exports._getHubAccess = exports._setHubAccess = exports._hubAccess = exports._verifyChannel = exports._releaseAllLocks = exports._nativeDb = exports._key = exports._getData = exports._faceProps = exports._elementWasCreated = exports._close = exports._implementationProhibited = void 0;
11
11
  exports._implementationProhibited = Symbol.for("Implementations of this interface can only be obtained from the containing package");
12
12
  function sym(name) {
13
13
  return `${name}_core-backend_INTERNAL_ONLY_DO_NOT_USE`;
@@ -21,4 +21,8 @@ exports._key = Symbol.for(sym("key"));
21
21
  exports._nativeDb = Symbol.for(sym("nativeDb"));
22
22
  exports._releaseAllLocks = Symbol.for(sym("releaseAllLocks"));
23
23
  exports._verifyChannel = Symbol.for(sym("verifyChannel"));
24
+ /** @internal */
25
+ exports._hubAccess = Symbol.for(sym("hubAccess"));
26
+ exports._setHubAccess = Symbol.for(sym("setHubAccess"));
27
+ exports._getHubAccess = Symbol.for(sym("getHubAccess"));
24
28
  //# sourceMappingURL=Symbols.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Symbols.js","sourceRoot":"","sources":["../../../src/internal/Symbols.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEU,QAAA,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,oFAAoF,CAAC,CAAC;AAE1I,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,GAAG,IAAI,wCAAwC,CAAC;AACzD,CAAC;AAEY,QAAA,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAClC,QAAA,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAC1D,QAAA,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1C,QAAA,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;AACtC,QAAA,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3C,gBAAgB;AACH,QAAA,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AACxC,QAAA,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACtD,QAAA,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Workspace\n */\n\nexport const _implementationProhibited = Symbol.for(\"Implementations of this interface can only be obtained from the containing package\");\n\nfunction sym(name: string): string {\n return `${name}_core-backend_INTERNAL_ONLY_DO_NOT_USE`;\n}\n\nexport const _close = Symbol.for(sym(\"close\"));\nexport const _elementWasCreated = Symbol.for(sym(\"elementWasCreated\"));\nexport const _faceProps = Symbol.for(sym(\"faceProps\"));\nexport const _getData = Symbol.for(sym(\"getData\"));\nexport const _key = Symbol.for(sym(\"key\"));\n/** @internal */\nexport const _nativeDb = Symbol.for(sym(\"nativeDb\"));\nexport const _releaseAllLocks = Symbol.for(sym(\"releaseAllLocks\"));\nexport const _verifyChannel = Symbol.for(sym(\"verifyChannel\"));\n"]}
1
+ {"version":3,"file":"Symbols.js","sourceRoot":"","sources":["../../../src/internal/Symbols.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEU,QAAA,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,oFAAoF,CAAC,CAAC;AAE1I,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,GAAG,IAAI,wCAAwC,CAAC;AACzD,CAAC;AAEY,QAAA,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAClC,QAAA,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAC1D,QAAA,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1C,QAAA,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;AACtC,QAAA,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3C,gBAAgB;AACH,QAAA,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AACxC,QAAA,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACtD,QAAA,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;AAC/D,gBAAgB;AACH,QAAA,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1C,QAAA,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;AAChD,QAAA,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Workspace\n */\n\nexport const _implementationProhibited = Symbol.for(\"Implementations of this interface can only be obtained from the containing package\");\n\nfunction sym(name: string): string {\n return `${name}_core-backend_INTERNAL_ONLY_DO_NOT_USE`;\n}\n\nexport const _close = Symbol.for(sym(\"close\"));\nexport const _elementWasCreated = Symbol.for(sym(\"elementWasCreated\"));\nexport const _faceProps = Symbol.for(sym(\"faceProps\"));\nexport const _getData = Symbol.for(sym(\"getData\"));\nexport const _key = Symbol.for(sym(\"key\"));\n/** @internal */\nexport const _nativeDb = Symbol.for(sym(\"nativeDb\"));\nexport const _releaseAllLocks = Symbol.for(sym(\"releaseAllLocks\"));\nexport const _verifyChannel = Symbol.for(sym(\"verifyChannel\"));\n/** @internal */\nexport const _hubAccess = Symbol.for(sym(\"hubAccess\"));\nexport const _setHubAccess = Symbol.for(sym(\"setHubAccess\"));\nexport const _getHubAccess = Symbol.for(sym(\"getHubAccess\"));\n"]}
@@ -232,7 +232,7 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
232
232
  const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });
233
233
  massPropResults.push(massProperties);
234
234
  }
235
- let singleCandidateResult = { status: core_bentley_1.BentleyStatus.ERROR, candidate };
235
+ let singleCandidateResult = { status: core_bentley_1.BentleyStatus.ERROR, candidate }; // eslint-disable-line @typescript-eslint/no-deprecated
236
236
  if (massPropResults.some((r) => r.status !== core_bentley_1.BentleyStatus.ERROR)) {
237
237
  singleCandidateResult.status = core_bentley_1.BentleyStatus.SUCCESS;
238
238
  for (const r of massPropResults.filter((mpr) => mpr.status !== core_bentley_1.BentleyStatus.ERROR)) {
@@ -245,7 +245,7 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
245
245
  return { status: core_bentley_1.BentleyStatus.ERROR, candidate };
246
246
  }
247
247
  };
248
- const promises = [];
248
+ const promises = []; // eslint-disable-line @typescript-eslint/no-deprecated
249
249
  for (const candidate of core_bentley_1.CompressedId64Set.iterable(props.candidates)) {
250
250
  promises.push(getSingleCandidateMassProperties(candidate));
251
251
  }