@itwin/core-backend 5.9.0-dev.7 → 5.9.0-dev.9

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 (55) hide show
  1. package/lib/cjs/BackendHubAccess.d.ts +38 -0
  2. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  3. package/lib/cjs/BackendHubAccess.js.map +1 -1
  4. package/lib/cjs/IModelDb.js +1 -1
  5. package/lib/cjs/IModelDb.js.map +1 -1
  6. package/lib/cjs/IpcHost.d.ts.map +1 -1
  7. package/lib/cjs/IpcHost.js +13 -4
  8. package/lib/cjs/IpcHost.js.map +1 -1
  9. package/lib/cjs/LockControl.d.ts +85 -1
  10. package/lib/cjs/LockControl.d.ts.map +1 -1
  11. package/lib/cjs/LockControl.js.map +1 -1
  12. package/lib/cjs/TxnManager.d.ts +100 -4
  13. package/lib/cjs/TxnManager.d.ts.map +1 -1
  14. package/lib/cjs/TxnManager.js +171 -8
  15. package/lib/cjs/TxnManager.js.map +1 -1
  16. package/lib/cjs/internal/HubMock.d.ts +2 -0
  17. package/lib/cjs/internal/HubMock.d.ts.map +1 -1
  18. package/lib/cjs/internal/HubMock.js +7 -0
  19. package/lib/cjs/internal/HubMock.js.map +1 -1
  20. package/lib/cjs/internal/NoLocks.d.ts.map +1 -1
  21. package/lib/cjs/internal/NoLocks.js +6 -0
  22. package/lib/cjs/internal/NoLocks.js.map +1 -1
  23. package/lib/cjs/internal/ServerBasedLocks.d.ts +12 -0
  24. package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -1
  25. package/lib/cjs/internal/ServerBasedLocks.js +285 -4
  26. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  27. package/lib/esm/BackendHubAccess.d.ts +38 -0
  28. package/lib/esm/BackendHubAccess.d.ts.map +1 -1
  29. package/lib/esm/BackendHubAccess.js.map +1 -1
  30. package/lib/esm/IModelDb.js +1 -1
  31. package/lib/esm/IModelDb.js.map +1 -1
  32. package/lib/esm/IpcHost.d.ts.map +1 -1
  33. package/lib/esm/IpcHost.js +13 -4
  34. package/lib/esm/IpcHost.js.map +1 -1
  35. package/lib/esm/LockControl.d.ts +85 -1
  36. package/lib/esm/LockControl.d.ts.map +1 -1
  37. package/lib/esm/LockControl.js.map +1 -1
  38. package/lib/esm/TxnManager.d.ts +100 -4
  39. package/lib/esm/TxnManager.d.ts.map +1 -1
  40. package/lib/esm/TxnManager.js +171 -8
  41. package/lib/esm/TxnManager.js.map +1 -1
  42. package/lib/esm/internal/HubMock.d.ts +2 -0
  43. package/lib/esm/internal/HubMock.d.ts.map +1 -1
  44. package/lib/esm/internal/HubMock.js +7 -0
  45. package/lib/esm/internal/HubMock.js.map +1 -1
  46. package/lib/esm/internal/NoLocks.d.ts.map +1 -1
  47. package/lib/esm/internal/NoLocks.js +6 -0
  48. package/lib/esm/internal/NoLocks.js.map +1 -1
  49. package/lib/esm/internal/ServerBasedLocks.d.ts +12 -0
  50. package/lib/esm/internal/ServerBasedLocks.d.ts.map +1 -1
  51. package/lib/esm/internal/ServerBasedLocks.js +286 -5
  52. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  53. package/lib/esm/test/standalone/ServerBasedLocks.test.js +907 -3
  54. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  55. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"IpcHost.d.ts","sourceRoot":"","sources":["../../src/IpcHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAEgC,yBAAyB,EAC7B,mBAAmB,EAAmB,WAAW,EAAE,gBAAgB,EACxC,cAAc,EAAkE,gBAAgB,EAC7J,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAwB,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAc,iBAAiB,EAAE,MAAM,cAAc,CAAC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AE,UAAU,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;IAInL;;;;OAIG;WACiB,OAAO,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAY7D,mEAAmE;WAC/C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAI9C;AAED;;;;;;;;;;;GAWG;AACH,8BAAsB,UAAU;IAC9B;;;;;;OAMG;IACH,aAAoB,WAAW,IAAI,MAAM,CAAC;IAE1C;;;;;OAKG;WACW,QAAQ,IAAI,cAAc;CA0DzC;AA6JD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAa9I"}
@@ -281,16 +281,25 @@ class IpcAppHandler extends IpcHandler {
281
281
  return IModelDb.findByKey(key)[_nativeDb].isGeometricModelTrackingSupported();
282
282
  }
283
283
  async reverseTxns(key, numOperations) {
284
- return IModelDb.findByKey(key)[_nativeDb].reverseTxns(numOperations);
284
+ return BriefcaseDb.findByKey(key).txns.reverseTxns(numOperations);
285
+ }
286
+ async reverseTxnsAsync(key, numOperations, args) {
287
+ return BriefcaseDb.findByKey(key).txns.reverseTxnsAsync(numOperations, args);
285
288
  }
286
289
  async reverseAllTxn(key) {
287
- return IModelDb.findByKey(key)[_nativeDb].reverseAll();
290
+ return BriefcaseDb.findByKey(key).txns.reverseAll();
291
+ }
292
+ async reverseAllTxnsAsync(key, args) {
293
+ return BriefcaseDb.findByKey(key).txns.reverseAllTxnsAsync(args);
288
294
  }
289
295
  async reinstateTxn(key) {
290
- return IModelDb.findByKey(key)[_nativeDb].reinstateTxn();
296
+ return BriefcaseDb.findByKey(key).txns.reinstateTxn();
297
+ }
298
+ async reinstateTxnAsync(key, args) {
299
+ return BriefcaseDb.findByKey(key).txns.reinstateTxnAsync(args);
291
300
  }
292
301
  async restartTxnSession(key) {
293
- return IModelDb.findByKey(key)[_nativeDb].restartTxnSession();
302
+ return IModelDb.findByKey(key).restartTxnSession();
294
303
  }
295
304
  async queryConcurrency(pool) {
296
305
  return IModelNative.platform.queryConcurrency(pool);
@@ -1 +1 @@
1
- {"version":3,"file":"IpcHost.js","sourceRoot":"","sources":["../../src/IpcHost.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAY,MAAM,qBAAqB,CAAC;AAChH,OAAO,EAE2D,wBAAwB,EAAyB,WAAW,EAAE,sBAAsB,EACpJ,cAAc,EAAwF,YAAY,GAEnH,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAoB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAqB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAmBzE;;;;GAIG;AACH,MAAM,OAAO,OAAO;IACX,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,MAAM,CAAC,IAAI,CAA+B;IAClD,2EAA2E;IACnE,MAAM,KAAK,GAAG,KAAuB,OAAO,IAAI,CAAC,IAAK,CAAC,CAAC,CAAC,CAAC,+DAA+D;IACjI,gIAAgI;IACzH,MAAM,KAAK,OAAO,KAAc,OAAO,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAExE;;;;OAIG;IACI,MAAM,CAAC,IAAI,CAAC,OAAe,E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C;QACvB,IAAI,MAAM,IAAI,KAAK,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;YACvC,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC;YAC1B,OAAO,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,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 NativeApp\n */\n\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { assert, BentleyError, IModelStatus, JsonUtils, Logger, LogLevel, OpenMode } from \"@itwin/core-bentley\";\nimport {\n BriefcaseConnectionProps,\n ChangesetIndex, ChangesetIndexAndId, EditingScopeNotifications, getPullChangesIpcChannel, IModelConnectionProps, IModelError, IModelNotFoundResponse, IModelRpcProps,\n ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketBackend, iTwinChannel,\n OpenBriefcaseProps, OpenCheckpointArgs, PullChangesOptions, RemoveFunction, SnapshotOpenOptions, StandaloneOpenOptions, TileTreeContentIds, TxnNotifications,\n} from \"@itwin/core-common\";\nimport { ProgressFunction, ProgressStatus } from \"./CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb, StandaloneDb } from \"./IModelDb\";\nimport { IModelHost, IModelHostOptions } from \"./IModelHost\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { _implicitTxn, _nativeDb } from \"./internal/Symbols\";\nimport { cancelTileContentRequests } from \"./rpc-impl/IModelTileRpcImpl\";\n\n/**\n * Options for [[IpcHost.startup]]\n * @public\n */\nexport interface IpcHostOpts {\n iModelHost?: IModelHostOptions;\n ipcHost?: {\n /** The Ipc socket to use for communications with frontend. Allows undefined only for headless tests. */\n socket?: IpcSocketBackend;\n\n /** don't send stack information on exceptions */\n exceptions?: {\n noStack?: boolean;\n };\n };\n}\n\n/**\n * Used by applications that have a dedicated backend. IpcHosts may send messages to their corresponding IpcApp.\n * @note if either end terminates, the other must too.\n * @public\n */\nexport class IpcHost {\n public static noStack = false;\n private static _ipc: IpcSocketBackend | undefined;\n /** Get the implementation of the [IpcSocketBackend]($common) interface. */\n private static get ipc(): IpcSocketBackend { return this._ipc!; } // eslint-disable-line @typescript-eslint/no-non-null-assertion\n /** Determine whether Ipc is available for this backend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Send a message to the frontend over an Ipc channel.\n * @param channel the name of the channel matching the name registered with [[IpcApp.addListener]].\n * @param data The content of the message.\n */\n public static send(channel: string, ...data: any[]): void {\n this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Establish a handler for an Ipc channel to receive [[Frontend.invoke]] calls\n * @param channel The name of the channel for this handler.\n * @param handler A function that supplies the implementation for `channel`\n * @note returns A function to call to remove the handler.\n */\n public static handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction {\n return this.ipc.handle(iTwinChannel(channel), handler);\n }\n /**\n * Establish a handler to receive messages sent via [[IpcApp.send]].\n * @param channel The name of the channel for the messages.\n * @param listener A function called when messages are sent over `channel`\n * @note returns A function to call to remove the listener.\n */\n public static addListener(channel: string, listener: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), listener);\n }\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener): void {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n private static notify(channel: string, briefcase: BriefcaseDb | StandaloneDb, methodName: string, ...args: any[]) {\n if (this.isValid)\n return this.send(`${channel}/${briefcase.key}`, methodName, ...args);\n }\n\n /** @internal */\n public static notifyIpcFrontend<T extends keyof IpcAppNotifications>(methodName: T, ...args: Parameters<IpcAppNotifications[T]>) {\n return IpcHost.send(ipcAppChannels.appNotify, methodName, ...args);\n }\n\n /** @internal */\n public static notifyTxns<T extends keyof TxnNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<TxnNotifications[T]>) {\n this.notify(ipcAppChannels.txns, briefcase, methodName, ...args);\n }\n\n /** @internal */\n public static notifyEditingScope<T extends keyof EditingScopeNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<EditingScopeNotifications[T]>) {\n this.notify(ipcAppChannels.editingScope, briefcase, methodName, ...args);\n }\n\n /**\n * Start the backend of an Ipc app.\n * @param opt\n * @note this method calls [[IModelHost.startup]] internally.\n */\n public static async startup(opt?: IpcHostOpts): Promise<void> {\n this._ipc = opt?.ipcHost?.socket;\n if (opt?.ipcHost?.exceptions?.noStack)\n this.noStack = true;\n\n if (this.isValid) { // for tests, we use IpcHost but don't have a frontend\n IpcAppHandler.register();\n }\n\n await IModelHost.startup(opt?.iModelHost);\n }\n\n /** Shutdown IpcHost backend. Also calls [[IModelHost.shutdown]] */\n public static async shutdown(): Promise<void> {\n this._ipc = undefined;\n await IModelHost.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc interface.\n *\n * Create a subclass to implement your Ipc interface. Your class should be declared like this:\n * ```ts\n * class MyHandler extends IpcHandler implements MyInterface\n * ```\n * to ensure all methods and signatures are correct.\n *\n * Then, call `MyClass.register` at startup to connect your class to your channel.\n * @public\n */\nexport abstract class IpcHandler {\n /**\n * All subclasses *must* implement this method to specify their channel name.\n *\n * Channel names are the key that connects Handlers and senders. The channel name of IpcHandlers must exactly match the name used by senders.\n * By convention, channel names should be prefixed by a *namespace* (e.g. `${appName}/`)\n * unique enough to disambiguate them from channels for other apps that may be running in the same processes.\n */\n public abstract get channelName(): string;\n\n /**\n * Register this class as the handler for methods on its channel. This static method creates a new instance\n * that becomes the handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, subsequent calls replace the previous ones.\n */\n public static register(): RemoveFunction {\n const impl = new (this as any)() as IpcHandler; // create an instance of subclass. \"as any\" is necessary because base class is abstract\n const prohibitedFunctions = Object.getOwnPropertyNames(Object.getPrototypeOf({}));\n\n return IpcHost.handle(impl.channelName, async (_evt: Event, funcName: string, ...args: any[]): Promise<IpcInvokeReturn> => {\n try {\n if (prohibitedFunctions.includes(funcName))\n throw new Error(`Method \"${funcName}\" not available for channel: ${impl.channelName}`);\n\n const func = (impl as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${impl.constructor.name}.${funcName}\" not found on IpcHandler registered for channel: ${impl.channelName}`);\n\n return { result: await func.call(impl, ...args) };\n } catch (err: unknown) {\n\n if (!JsonUtils.isObject(err)) // if the exception isn't an object, just forward it\n return { error: err as any };\n\n const serializeError = (e: any, includeStack: boolean, visited = new WeakSet<object>()): any => {\n if (visited.has(e))\n return undefined;\n visited.add(e);\n try {\n const serialized: any = { ...e };\n if (e instanceof Error) {\n serialized.message = e.message; // NB: .message and .stack are non-enumerable on Error instances\n if (includeStack)\n serialized.stack = e.stack;\n }\n // Only recurse into Error instances and plain objects — not class instances like Date or Buffer.\n const shouldRecurse = (val: any) => val instanceof Error || (JsonUtils.isObject(val) && Object.getPrototypeOf(val) === Object.prototype);\n for (const key of Object.keys(serialized)) {\n const val = serialized[key];\n if (Array.isArray(val))\n serialized[key] = val.map((item) => shouldRecurse(item) ? serializeError(item, includeStack, visited) : item);\n else if (shouldRecurse(val))\n serialized[key] = serializeError(val, includeStack, visited);\n }\n return serialized;\n } finally {\n // Remove from the stack so a sibling branch can still serialize this object.\n visited.delete(e);\n }\n };\n\n const ret = { error: serializeError(err, !IpcHost.noStack) };\n\n if (err instanceof BentleyError) {\n ret.error.iTwinErrorId = err.iTwinErrorId;\n if (err.hasMetaData)\n ret.error.loggingMetadata = err.loggingMetadata;\n delete ret.error._metaData;\n }\n return ret;\n }\n });\n }\n}\n\n/**\n * Implementation of IpcAppFunctions\n */\nclass IpcAppHandler extends IpcHandler implements IpcAppFunctions {\n public get channelName() { return ipcAppChannels.functions; }\n\n private _iModelKeyToPullStatus = new Map<string, ProgressStatus>();\n\n public async log(_timestamp: number, level: LogLevel, category: string, message: string, metaData?: any): Promise<void> {\n switch (level) {\n case LogLevel.Error:\n Logger.logError(category, message, metaData);\n break;\n case LogLevel.Info:\n Logger.logInfo(category, message, metaData);\n break;\n case LogLevel.Trace:\n Logger.logTrace(category, message, metaData);\n break;\n case LogLevel.Warning:\n Logger.logWarning(category, message, metaData);\n break;\n }\n }\n\n public async cancelTileContentRequests(tokenProps: IModelRpcProps, contentIds: TileTreeContentIds[]): Promise<void> {\n return cancelTileContentRequests(tokenProps, contentIds);\n }\n public async cancelElementGraphicsRequests(key: string, requestIds: string[]): Promise<void> {\n return IModelDb.findByKey(key)[_nativeDb].cancelElementGraphicsRequests(requestIds);\n }\n public async openBriefcase(args: OpenBriefcaseProps): Promise<BriefcaseConnectionProps> {\n const db = await BriefcaseDb.open(args);\n return db.toJSON();\n }\n public async openCheckpoint(checkpoint: OpenCheckpointArgs): Promise<IModelConnectionProps> {\n return (await SnapshotDb.openCheckpoint(checkpoint)).getConnectionProps();\n }\n public async openStandalone(filePath: string, openMode: OpenMode, opts?: StandaloneOpenOptions): Promise<IModelConnectionProps> {\n return StandaloneDb.openFile(filePath, openMode, opts).getConnectionProps();\n }\n public async openSnapshot(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n let resolvedFileName: string | undefined = filePath;\n if (IModelHost.snapshotFileNameResolver) { // eslint-disable-line @typescript-eslint/no-deprecated\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath); // eslint-disable-line @typescript-eslint/no-deprecated\n if (!resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\n }\n public async closeIModel(key: string): Promise<void> {\n IModelDb.findByKey(key).close();\n }\n public async saveChanges(key: string, description?: string): Promise<void> {\n IModelDb.findByKey(key)[_implicitTxn].saveChanges(description);\n }\n public async abandonChanges(key: string): Promise<void> {\n IModelDb.findByKey(key)[_implicitTxn].abandonChanges();\n }\n public async hasPendingTxns(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].hasPendingTxns();\n }\n\n public async isUndoPossible(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isUndoPossible();\n }\n public async isRedoPossible(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isRedoPossible();\n }\n public async getUndoString(key: string): Promise<string> {\n return IModelDb.findByKey(key)[_nativeDb].getUndoString();\n }\n public async getRedoString(key: string): Promise<string> {\n return IModelDb.findByKey(key)[_nativeDb].getRedoString();\n }\n\n public async pullChanges(key: string, toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<ChangesetIndexAndId> {\n const iModelDb = BriefcaseDb.findByKey(key);\n\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Continue);\n const checkAbort = () => this._iModelKeyToPullStatus.get(key) ?? ProgressStatus.Continue;\n\n let onProgress: ProgressFunction | undefined;\n if (options?.reportProgress) {\n const progressCallback: ProgressFunction = (loaded, total) => {\n IpcHost.send(getPullChangesIpcChannel(iModelDb.iModelId), { loaded, total });\n return checkAbort();\n };\n onProgress = throttleProgressCallback(progressCallback, checkAbort, options?.progressInterval);\n } else if (options?.enableCancellation) {\n onProgress = checkAbort;\n }\n\n try {\n await iModelDb.pullChanges({ toIndex, onProgress });\n } finally {\n this._iModelKeyToPullStatus.delete(key);\n }\n\n return iModelDb.changeset as ChangesetIndexAndId;\n }\n public async cancelPullChangesRequest(key: string): Promise<void> {\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Abort);\n }\n\n public async pushChanges(key: string, description: string): Promise<ChangesetIndexAndId> {\n const iModelDb = BriefcaseDb.findByKey(key);\n await iModelDb.pushChanges({ description });\n return iModelDb.changeset as ChangesetIndexAndId;\n }\n\n public async toggleGraphicalEditingScope(key: string, startSession: boolean): Promise<boolean> {\n const val: IModelJsNative.ErrorStatusOrResult<any, boolean> = IModelDb.findByKey(key)[_nativeDb].setGeometricModelTrackingEnabled(startSession);\n if (val.error)\n throw new IModelError(val.error.status, \"Failed to toggle graphical editing scope\");\n assert(undefined !== val.result);\n return val.result;\n }\n public async isGraphicalEditingSupported(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isGeometricModelTrackingSupported();\n }\n\n public async reverseTxns(key: string, numOperations: number): Promise<IModelStatus> {\n return IModelDb.findByKey(key)[_nativeDb].reverseTxns(numOperations);\n }\n public async reverseAllTxn(key: string): Promise<IModelStatus> {\n return IModelDb.findByKey(key)[_nativeDb].reverseAll();\n }\n public async reinstateTxn(key: string): Promise<IModelStatus> {\n return IModelDb.findByKey(key)[_nativeDb].reinstateTxn();\n }\n public async restartTxnSession(key: string): Promise<void> {\n return IModelDb.findByKey(key)[_nativeDb].restartTxnSession();\n }\n\n public async queryConcurrency(pool: \"io\" | \"cpu\"): Promise<number> {\n return IModelNative.platform.queryConcurrency(pool);\n }\n}\n\n/**\n * Prevents progress callback being called more frequently when provided interval.\n * @internal\n */\nexport function throttleProgressCallback(func: ProgressFunction, checkAbort: () => ProgressStatus, progressInterval?: number): ProgressFunction {\n const interval = progressInterval ?? 250; // by default, only send progress events every 250 milliseconds\n let nextTime = Date.now() + interval;\n const progressCallback: ProgressFunction = (loaded, total) => {\n const now = Date.now();\n if (loaded >= total || now >= nextTime) {\n nextTime = now + interval;\n return func(loaded, total);\n }\n return checkAbort();\n };\n\n return progressCallback;\n}\n"]}
1
+ {"version":3,"file":"IpcHost.js","sourceRoot":"","sources":["../../src/IpcHost.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,YAA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,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC;IACrC,MAAM,gBAAgB,GAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,MAAM,IAAI,KAAK,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;YACvC,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC;YAC1B,OAAO,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,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 NativeApp\n */\n\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { assert, BentleyError, IModelStatus, JsonUtils, Logger, LogLevel, OpenMode } from \"@itwin/core-bentley\";\nimport {\n BriefcaseConnectionProps,\n ChangesetIndex, ChangesetIndexAndId, EditingScopeNotifications, getPullChangesIpcChannel, IModelConnectionProps, IModelError, IModelNotFoundResponse, IModelRpcProps,\n ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketBackend, iTwinChannel,\n OpenBriefcaseProps, OpenCheckpointArgs, PullChangesOptions, ReinstateTxnArgs, RemoveFunction, ReverseTxnArgs, SnapshotOpenOptions,\n StandaloneOpenOptions, TileTreeContentIds, TxnNotifications,\n} from \"@itwin/core-common\";\nimport { ProgressFunction, ProgressStatus } from \"./CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb, StandaloneDb } from \"./IModelDb\";\nimport { IModelHost, IModelHostOptions } from \"./IModelHost\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { _implicitTxn, _nativeDb } from \"./internal/Symbols\";\nimport { cancelTileContentRequests } from \"./rpc-impl/IModelTileRpcImpl\";\n\n/**\n * Options for [[IpcHost.startup]]\n * @public\n */\nexport interface IpcHostOpts {\n iModelHost?: IModelHostOptions;\n ipcHost?: {\n /** The Ipc socket to use for communications with frontend. Allows undefined only for headless tests. */\n socket?: IpcSocketBackend;\n\n /** don't send stack information on exceptions */\n exceptions?: {\n noStack?: boolean;\n };\n };\n}\n\n/**\n * Used by applications that have a dedicated backend. IpcHosts may send messages to their corresponding IpcApp.\n * @note if either end terminates, the other must too.\n * @public\n */\nexport class IpcHost {\n public static noStack = false;\n private static _ipc: IpcSocketBackend | undefined;\n /** Get the implementation of the [IpcSocketBackend]($common) interface. */\n private static get ipc(): IpcSocketBackend { return this._ipc!; } // eslint-disable-line @typescript-eslint/no-non-null-assertion\n /** Determine whether Ipc is available for this backend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Send a message to the frontend over an Ipc channel.\n * @param channel the name of the channel matching the name registered with [[IpcApp.addListener]].\n * @param data The content of the message.\n */\n public static send(channel: string, ...data: any[]): void {\n this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Establish a handler for an Ipc channel to receive [[Frontend.invoke]] calls\n * @param channel The name of the channel for this handler.\n * @param handler A function that supplies the implementation for `channel`\n * @note returns A function to call to remove the handler.\n */\n public static handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction {\n return this.ipc.handle(iTwinChannel(channel), handler);\n }\n /**\n * Establish a handler to receive messages sent via [[IpcApp.send]].\n * @param channel The name of the channel for the messages.\n * @param listener A function called when messages are sent over `channel`\n * @note returns A function to call to remove the listener.\n */\n public static addListener(channel: string, listener: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), listener);\n }\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener): void {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n private static notify(channel: string, briefcase: BriefcaseDb | StandaloneDb, methodName: string, ...args: any[]) {\n if (this.isValid)\n return this.send(`${channel}/${briefcase.key}`, methodName, ...args);\n }\n\n /** @internal */\n public static notifyIpcFrontend<T extends keyof IpcAppNotifications>(methodName: T, ...args: Parameters<IpcAppNotifications[T]>) {\n return IpcHost.send(ipcAppChannels.appNotify, methodName, ...args);\n }\n\n /** @internal */\n public static notifyTxns<T extends keyof TxnNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<TxnNotifications[T]>) {\n this.notify(ipcAppChannels.txns, briefcase, methodName, ...args);\n }\n\n /** @internal */\n public static notifyEditingScope<T extends keyof EditingScopeNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<EditingScopeNotifications[T]>) {\n this.notify(ipcAppChannels.editingScope, briefcase, methodName, ...args);\n }\n\n /**\n * Start the backend of an Ipc app.\n * @param opt\n * @note this method calls [[IModelHost.startup]] internally.\n */\n public static async startup(opt?: IpcHostOpts): Promise<void> {\n this._ipc = opt?.ipcHost?.socket;\n if (opt?.ipcHost?.exceptions?.noStack)\n this.noStack = true;\n\n if (this.isValid) { // for tests, we use IpcHost but don't have a frontend\n IpcAppHandler.register();\n }\n\n await IModelHost.startup(opt?.iModelHost);\n }\n\n /** Shutdown IpcHost backend. Also calls [[IModelHost.shutdown]] */\n public static async shutdown(): Promise<void> {\n this._ipc = undefined;\n await IModelHost.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc interface.\n *\n * Create a subclass to implement your Ipc interface. Your class should be declared like this:\n * ```ts\n * class MyHandler extends IpcHandler implements MyInterface\n * ```\n * to ensure all methods and signatures are correct.\n *\n * Then, call `MyClass.register` at startup to connect your class to your channel.\n * @public\n */\nexport abstract class IpcHandler {\n /**\n * All subclasses *must* implement this method to specify their channel name.\n *\n * Channel names are the key that connects Handlers and senders. The channel name of IpcHandlers must exactly match the name used by senders.\n * By convention, channel names should be prefixed by a *namespace* (e.g. `${appName}/`)\n * unique enough to disambiguate them from channels for other apps that may be running in the same processes.\n */\n public abstract get channelName(): string;\n\n /**\n * Register this class as the handler for methods on its channel. This static method creates a new instance\n * that becomes the handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, subsequent calls replace the previous ones.\n */\n public static register(): RemoveFunction {\n const impl = new (this as any)() as IpcHandler; // create an instance of subclass. \"as any\" is necessary because base class is abstract\n const prohibitedFunctions = Object.getOwnPropertyNames(Object.getPrototypeOf({}));\n\n return IpcHost.handle(impl.channelName, async (_evt: Event, funcName: string, ...args: any[]): Promise<IpcInvokeReturn> => {\n try {\n if (prohibitedFunctions.includes(funcName))\n throw new Error(`Method \"${funcName}\" not available for channel: ${impl.channelName}`);\n\n const func = (impl as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${impl.constructor.name}.${funcName}\" not found on IpcHandler registered for channel: ${impl.channelName}`);\n\n return { result: await func.call(impl, ...args) };\n } catch (err: unknown) {\n\n if (!JsonUtils.isObject(err)) // if the exception isn't an object, just forward it\n return { error: err as any };\n\n const serializeError = (e: any, includeStack: boolean, visited = new WeakSet<object>()): any => {\n if (visited.has(e))\n return undefined;\n visited.add(e);\n try {\n const serialized: any = { ...e };\n if (e instanceof Error) {\n serialized.message = e.message; // NB: .message and .stack are non-enumerable on Error instances\n if (includeStack)\n serialized.stack = e.stack;\n }\n // Only recurse into Error instances and plain objects — not class instances like Date or Buffer.\n const shouldRecurse = (val: any) => val instanceof Error || (JsonUtils.isObject(val) && Object.getPrototypeOf(val) === Object.prototype);\n for (const key of Object.keys(serialized)) {\n const val = serialized[key];\n if (Array.isArray(val))\n serialized[key] = val.map((item) => shouldRecurse(item) ? serializeError(item, includeStack, visited) : item);\n else if (shouldRecurse(val))\n serialized[key] = serializeError(val, includeStack, visited);\n }\n return serialized;\n } finally {\n // Remove from the stack so a sibling branch can still serialize this object.\n visited.delete(e);\n }\n };\n\n const ret = { error: serializeError(err, !IpcHost.noStack) };\n\n if (err instanceof BentleyError) {\n ret.error.iTwinErrorId = err.iTwinErrorId;\n if (err.hasMetaData)\n ret.error.loggingMetadata = err.loggingMetadata;\n delete ret.error._metaData;\n }\n return ret;\n }\n });\n }\n}\n\n/**\n * Implementation of IpcAppFunctions\n */\nclass IpcAppHandler extends IpcHandler implements IpcAppFunctions {\n public get channelName() { return ipcAppChannels.functions; }\n\n private _iModelKeyToPullStatus = new Map<string, ProgressStatus>();\n\n public async log(_timestamp: number, level: LogLevel, category: string, message: string, metaData?: any): Promise<void> {\n switch (level) {\n case LogLevel.Error:\n Logger.logError(category, message, metaData);\n break;\n case LogLevel.Info:\n Logger.logInfo(category, message, metaData);\n break;\n case LogLevel.Trace:\n Logger.logTrace(category, message, metaData);\n break;\n case LogLevel.Warning:\n Logger.logWarning(category, message, metaData);\n break;\n }\n }\n\n public async cancelTileContentRequests(tokenProps: IModelRpcProps, contentIds: TileTreeContentIds[]): Promise<void> {\n return cancelTileContentRequests(tokenProps, contentIds);\n }\n public async cancelElementGraphicsRequests(key: string, requestIds: string[]): Promise<void> {\n return IModelDb.findByKey(key)[_nativeDb].cancelElementGraphicsRequests(requestIds);\n }\n public async openBriefcase(args: OpenBriefcaseProps): Promise<BriefcaseConnectionProps> {\n const db = await BriefcaseDb.open(args);\n return db.toJSON();\n }\n public async openCheckpoint(checkpoint: OpenCheckpointArgs): Promise<IModelConnectionProps> {\n return (await SnapshotDb.openCheckpoint(checkpoint)).getConnectionProps();\n }\n public async openStandalone(filePath: string, openMode: OpenMode, opts?: StandaloneOpenOptions): Promise<IModelConnectionProps> {\n return StandaloneDb.openFile(filePath, openMode, opts).getConnectionProps();\n }\n public async openSnapshot(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n let resolvedFileName: string | undefined = filePath;\n if (IModelHost.snapshotFileNameResolver) { // eslint-disable-line @typescript-eslint/no-deprecated\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath); // eslint-disable-line @typescript-eslint/no-deprecated\n if (!resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\n }\n public async closeIModel(key: string): Promise<void> {\n IModelDb.findByKey(key).close();\n }\n public async saveChanges(key: string, description?: string): Promise<void> {\n IModelDb.findByKey(key)[_implicitTxn].saveChanges(description);\n }\n public async abandonChanges(key: string): Promise<void> {\n IModelDb.findByKey(key)[_implicitTxn].abandonChanges();\n }\n public async hasPendingTxns(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].hasPendingTxns();\n }\n\n public async isUndoPossible(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isUndoPossible();\n }\n public async isRedoPossible(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isRedoPossible();\n }\n public async getUndoString(key: string): Promise<string> {\n return IModelDb.findByKey(key)[_nativeDb].getUndoString();\n }\n public async getRedoString(key: string): Promise<string> {\n return IModelDb.findByKey(key)[_nativeDb].getRedoString();\n }\n\n public async pullChanges(key: string, toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<ChangesetIndexAndId> {\n const iModelDb = BriefcaseDb.findByKey(key);\n\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Continue);\n const checkAbort = () => this._iModelKeyToPullStatus.get(key) ?? ProgressStatus.Continue;\n\n let onProgress: ProgressFunction | undefined;\n if (options?.reportProgress) {\n const progressCallback: ProgressFunction = (loaded, total) => {\n IpcHost.send(getPullChangesIpcChannel(iModelDb.iModelId), { loaded, total });\n return checkAbort();\n };\n onProgress = throttleProgressCallback(progressCallback, checkAbort, options?.progressInterval);\n } else if (options?.enableCancellation) {\n onProgress = checkAbort;\n }\n\n try {\n await iModelDb.pullChanges({ toIndex, onProgress });\n } finally {\n this._iModelKeyToPullStatus.delete(key);\n }\n\n return iModelDb.changeset as ChangesetIndexAndId;\n }\n public async cancelPullChangesRequest(key: string): Promise<void> {\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Abort);\n }\n\n public async pushChanges(key: string, description: string): Promise<ChangesetIndexAndId> {\n const iModelDb = BriefcaseDb.findByKey(key);\n await iModelDb.pushChanges({ description });\n return iModelDb.changeset as ChangesetIndexAndId;\n }\n\n public async toggleGraphicalEditingScope(key: string, startSession: boolean): Promise<boolean> {\n const val: IModelJsNative.ErrorStatusOrResult<any, boolean> = IModelDb.findByKey(key)[_nativeDb].setGeometricModelTrackingEnabled(startSession);\n if (val.error)\n throw new IModelError(val.error.status, \"Failed to toggle graphical editing scope\");\n assert(undefined !== val.result);\n return val.result;\n }\n public async isGraphicalEditingSupported(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isGeometricModelTrackingSupported();\n }\n\n public async reverseTxns(key: string, numOperations: number): Promise<IModelStatus> {\n return BriefcaseDb.findByKey(key).txns.reverseTxns(numOperations);\n }\n\n public async reverseTxnsAsync(key: string, numOperations: number, args?: ReverseTxnArgs): Promise<void> {\n return BriefcaseDb.findByKey(key).txns.reverseTxnsAsync(numOperations, args);\n }\n\n public async reverseAllTxn(key: string): Promise<IModelStatus> {\n return BriefcaseDb.findByKey(key).txns.reverseAll();\n }\n\n public async reverseAllTxnsAsync(key: string, args?: ReverseTxnArgs): Promise<void> {\n return BriefcaseDb.findByKey(key).txns.reverseAllTxnsAsync(args);\n }\n\n public async reinstateTxn(key: string): Promise<IModelStatus> {\n return BriefcaseDb.findByKey(key).txns.reinstateTxn();\n }\n\n public async reinstateTxnAsync(key: string, args?: ReinstateTxnArgs): Promise<void> {\n return BriefcaseDb.findByKey(key).txns.reinstateTxnAsync(args);\n }\n\n public async restartTxnSession(key: string): Promise<void> {\n return IModelDb.findByKey(key).restartTxnSession();\n }\n\n public async queryConcurrency(pool: \"io\" | \"cpu\"): Promise<number> {\n return IModelNative.platform.queryConcurrency(pool);\n }\n}\n\n/**\n * Prevents progress callback being called more frequently when provided interval.\n * @internal\n */\nexport function throttleProgressCallback(func: ProgressFunction, checkAbort: () => ProgressStatus, progressInterval?: number): ProgressFunction {\n const interval = progressInterval ?? 250; // by default, only send progress events every 250 milliseconds\n let nextTime = Date.now() + interval;\n const progressCallback: ProgressFunction = (loaded, total) => {\n const now = Date.now();\n if (loaded >= total || now >= nextTime) {\n nextTime = now + interval;\n return func(loaded, total);\n }\n return checkAbort();\n };\n\n return progressCallback;\n}\n"]}
@@ -49,6 +49,9 @@ export interface LockControl {
49
49
  * If any required lock is not available, this method throws an exception and *none* of the requested locks are acquired.
50
50
  * @note Acquiring the exclusive lock on an element requires also obtaining a shared lock on all its owner elements. This method will
51
51
  * attempt to acquire all necessary locks for both sets of input ids.
52
+ * @note Calling this method after reversing or reinstating a Txn indicates the start of a brand new Txn with the current Txn ID,
53
+ * making it invalid to call [[abandonLocksForReversedTxn]] or [[acquireLocksForReinstatingTxn]] for previously-reversed
54
+ * Txns with the current ID or greater.
52
55
  */
53
56
  acquireLocks(arg: {
54
57
  /** if present, one or more elements to obtain shared lock */
@@ -56,18 +59,99 @@ export interface LockControl {
56
59
  /** if present, one or more elements to obtain exclusive lock */
57
60
  exclusive?: Id64Arg;
58
61
  }): Promise<void>;
59
- /** Release all locks currently held by this briefcase from the locker server.
62
+ /** Release all locks currently held by this briefcase from the lock server after editing the associated elements.
60
63
  * This is typically done on your behalf by [[BriefcaseDb.pushChanges]].
64
+ * If you are abandoning changes instead of pushing them, you should call [[abandonAllLocks]] instead.
61
65
  * You may want to do it manually when abandoning all of your briefcase's local changes.
62
66
  * You cannot release your locks if your briefcase contains local changes.
63
67
  * @throws Error if the briefcase has local changes, or if any other error occurs while releasing the locks.
64
68
  */
65
69
  releaseAllLocks(): Promise<void>;
70
+ /**
71
+ * Abandons all locks currently held by this briefcase when none of the associated elements have
72
+ * been or will be modified. This is only valid to do when none of the elements protected by
73
+ * the currently-held locks have been edited, or if all edits have been reversed or abandoned without
74
+ * pushing them.
75
+ * @beta
76
+ *
77
+ * The locks are released on the IModelHub, but the changeset associated with the locks is not updated,
78
+ * reflecting the fact that the associated elements were not edited.
79
+ */
80
+ abandonAllLocks(): Promise<void>;
66
81
  /**
67
82
  * Release all locks currently held by this Briefcase from the lock server.
68
83
  * Not possible to release locks unless push or abandon all changes. Should only be called internally.
69
84
  * @internal
70
85
  */
71
86
  [_releaseAllLocks]: () => Promise<void>;
87
+ /**
88
+ * Abandons the locks that were acquired during a given Txn and all later Txns, all of which must already
89
+ * have been reversed.
90
+ * @beta
91
+ *
92
+ * @param txnId The ID of the first Txn whose locks should be abandoned. This must either be a Txn that has
93
+ * already been reversed, or the [[TxnManager.getCurrentTxnId]]. In either case, the current Txn must not
94
+ * have any unsaved changes.
95
+ * @returns A promise that resolves to true if any locks were successfully abandoned. False if there were no locks to abandon,
96
+ * which may be the case if the Txns did not acquire any locks or if they were already abandoned. The Promise rejects
97
+ * with an ITwinError if the Txn has not been reversed, the current Txn has unsaved changes, or if any other error occurs
98
+ * while releasing the locks.
99
+ * @note This method also implicitly calls [[abandonLocksForCurrentUnsavedTxn]]. Locks acquired in the current,
100
+ * unsaved Txn will be abandoned when calling this method. However, they can not be re-acquired using
101
+ * [[acquireLocksForReinstatingTxn]]. This is because there is no way to recover these unsaved changes after abandoning
102
+ * them, so it is rarely useful to re-acquire the locks associated with irrecoverable changes.
103
+ */
104
+ abandonLocksForReversedTxn(txnId: Id64String): Promise<boolean>;
105
+ /**
106
+ * Abandons the locks that were acquired during the current, unsaved Txn. Any changes in the unsaved Txn must be abandoned
107
+ * before calling this method.
108
+ * @beta
109
+ *
110
+ * @returns A promise that resolves to true if any locks were successfully abandoned. False if there were no locks to abandon,
111
+ * which may be the case if the current Txn did not acquire any locks or if they were already abandoned. The Promise rejects
112
+ * with an ITwinError if the current Txn has unsaved changes, or if any other error occurs while releasing the locks.
113
+ */
114
+ abandonLocksForCurrentUnsavedTxn(): Promise<boolean>;
115
+ /**
116
+ * Re-acquire the locks that were previously acquired during a given Txn and all previous Txns. These locks are
117
+ * expected to have previously been released with {@link LockControl.abandonLocksForReversedTxn}. This is used
118
+ * just before reinstating a previously-reversed Txn to ensure that the necessary locks are held for the
119
+ * reinstated changes.
120
+ * @beta
121
+ *
122
+ * It is possible that the locks may no longer be available, in which case the returned Promise will reject
123
+ * with an exception.
124
+ *
125
+ * @param txnId The ID of the last Txn whose locks should be re-acquired.
126
+ * @returns A promise that resolves to true if any locks were successfully acquired. False if there were no locks to acquire,
127
+ * which may be the case if the Txn in question did not acquire any locks or if they were already re-acquired. The Promise
128
+ * rejects with an ITwinError if the Txn does not exist, the current Txn has unsaved changes, the locks cannot be acquired,
129
+ * or if any other error occurs while acquiring the locks.
130
+ */
131
+ acquireLocksForReinstatingTxn(txnId: Id64String): Promise<boolean>;
132
+ /**
133
+ * Checks whether the locks originally acquired for a specified reversed Txn, and all earlier Txns, were either not abandoned
134
+ * or have already been re-acquired.
135
+ * @beta
136
+ *
137
+ * If this method returns true, it is safe to reinstate the given Txn with [[TxnManager.reinstateTxn]]. If it returns false,
138
+ * the necessary locks must be acquired first, either by calling [[TxnManager.reinstateTxnAsync]] or by explicitly calling
139
+ * [[acquireLocksForReinstatingTxn]] first.
140
+ *
141
+ * @param txnId The ID of the Txn to check.
142
+ * @returns True if the necessary locks are currently held, false otherwise.
143
+ */
144
+ holdsNecessaryLocksForReinstatingTxn(txnId: Id64String): boolean;
145
+ /**
146
+ * Clears the records of locks acquired for a given Txn and all later Txns from the local lock database. Call this after
147
+ * a Txn becomes unreachable. This allows an ID to potentially be reused for a different Txn in the future.
148
+ * @beta
149
+ *
150
+ * After invoking this method, {@link LockControl.abandonLocksForReversedTxn} and {@link LockControl.acquireLocksForReinstatingTxn} will no
151
+ * longer be able to operate on this Txn or any later Txns.
152
+ *
153
+ * @param txnId The ID of the first Txn whose lock records should be cleared.
154
+ */
155
+ clearTxnLockRecords(txnId: Id64String): void;
72
156
  }
73
157
  //# sourceMappingURL=LockControl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LockControl.d.ts","sourceRoot":"","sources":["../../src/LockControl.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE7G;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,eAAe;IACf,QAAQ,CAAC,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAE9C;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAEhC;;;OAGG;IACH,CAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;;OAGG;IACH,CAAC,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,IAAI,CAAC;IAE/C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1E;;;OAGG;IACH,eAAe,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvE;;OAEG;IACH,kBAAkB,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC;IAE5C;;OAEG;IACH,eAAe,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC;IAEzC;;;;;OAKG;IACH,YAAY,CAAC,GAAG,EAAE;QAChB,6DAA6D;QAC7D,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,gEAAgE;QAChE,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElB;;;;;OAKG;IACH,eAAe,IAAI,OAAO,CAAC,IA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CAAC;IAElB;;;;;;OAMG;IACH,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC;;;;;;;;;OASG;IACH,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC;;;;OAIG;IACH,CAAC,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;;;;;;;;;;;;;;OAgBG;IACH,0BAA0B,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhE;;;;;;;;OAQG;IACH,gCAAgC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD;;;;;;;;;;;;;;;OAeG;IACH,6BAA6B,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnE;;;;;;;;;;;OAWG;IACH,oCAAoC,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC;IAEjE;;;;;;;;;OASG;IACH,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"LockControl.js","sourceRoot":"","sources":["../../src/LockControl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,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 iModels\n */\n\nimport { Id64Arg, Id64String } from \"@itwin/core-bentley\";\nimport { _close, _elementWasCreated, _implementationProhibited, _releaseAllLocks } from \"./internal/Symbols\";\n\n/**\n * Interface for acquiring element locks to [coordinate simultaneous edits]($docs/learning/backend/ConcurrencyControl.md) from multiple briefcases.\n * @see [[IModelDb.locks]] to access the locks for an iModel.\n * @public\n */\nexport interface LockControl {\n /** @internal*/\n readonly [_implementationProhibited]: unknown;\n\n /**\n * true if this LockControl uses a server-based concurrency approach.\n */\n readonly isServerBased: boolean;\n\n /**\n * Close the local lock control database\n * @internal\n */\n [_close]: () => void;\n\n /**\n * Notification that a new element was just created. Called by [[Element.onInserted]]\n * @internal\n */\n [_elementWasCreated]: (id: Id64String) => void;\n\n /**\n * Throw if locks are required and the exclusive lock is not held on the supplied element.\n * Note: there is no need to check the shared locks on parents/models since an element cannot hold the exclusive lock without first obtaining them.\n * Called by functions like [[Element.onUpdate]], [[Element.onDelete]], etc.\n */\n checkExclusiveLock(id: Id64String, type: string, operation: string): void;\n\n /**\n * Throw if locks are required and a shared lock is not held on the supplied element.\n * Called by [[Element.onInsert]] to ensure shared lock is held on the new element's model and parent element.\n */\n checkSharedLock(id: Id64String, type: string, operation: string): void;\n\n /**\n * Determine whether the owning iModel currently holds the exclusive lock on the specified element.\n */\n holdsExclusiveLock(id: Id64String): boolean;\n\n /**\n * Determine whether the owning iModel currently holds a shared lock on the specified element.\n */\n holdsSharedLock(id: Id64String): boolean;\n\n /**\n * Acquire locks on one or more elements from the lock server, if required and not already held.\n * If any required lock is not available, this method throws an exception and *none* of the requested locks are acquired.\n * @note Acquiring the exclusive lock on an element requires also obtaining a shared lock on all its owner elements. This method will\n * attempt to acquire all necessary locks for both sets of input ids.\n */\n acquireLocks(arg: {\n /** if present, one or more elements to obtain shared lock */\n shared?: Id64Arg;\n /** if present, one or more elements to obtain exclusive lock */\n exclusive?: Id64Arg;\n }): Promise<void>;\n\n /** Release all locks currently held by this briefcase from the locker server.\n * This is typically done on your behalf by [[BriefcaseDb.pushChanges]].\n * You may want to do it manually when abandoning all of your briefcase's local changes.\n * You cannot release your locks if your briefcase contains local changes.\n * @throws Error if the briefcase has local changes, or if any other error occurs while releasing the locks.\n */\n releaseAllLocks(): Promise<void>;\n\n /**\n * Release all locks currently held by this Briefcase from the lock server.\n * Not possible to release locks unless push or abandon all changes. Should only be called internally.\n * @internal\n */\n [_releaseAllLocks]: () => Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"LockControl.js","sourceRoot":"","sources":["../../src/LockControl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,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 iModels\n */\n\nimport { Id64Arg, Id64String } from \"@itwin/core-bentley\";\nimport { _close, _elementWasCreated, _implementationProhibited, _releaseAllLocks } from \"./internal/Symbols\";\n\n/**\n * Interface for acquiring element locks to [coordinate simultaneous edits]($docs/learning/backend/ConcurrencyControl.md) from multiple briefcases.\n * @see [[IModelDb.locks]] to access the locks for an iModel.\n * @public\n */\nexport interface LockControl {\n /** @internal*/\n readonly [_implementationProhibited]: unknown;\n\n /**\n * true if this LockControl uses a server-based concurrency approach.\n */\n readonly isServerBased: boolean;\n\n /**\n * Close the local lock control database\n * @internal\n */\n [_close]: () => void;\n\n /**\n * Notification that a new element was just created. Called by [[Element.onInserted]]\n * @internal\n */\n [_elementWasCreated]: (id: Id64String) => void;\n\n /**\n * Throw if locks are required and the exclusive lock is not held on the supplied element.\n * Note: there is no need to check the shared locks on parents/models since an element cannot hold the exclusive lock without first obtaining them.\n * Called by functions like [[Element.onUpdate]], [[Element.onDelete]], etc.\n */\n checkExclusiveLock(id: Id64String, type: string, operation: string): void;\n\n /**\n * Throw if locks are required and a shared lock is not held on the supplied element.\n * Called by [[Element.onInsert]] to ensure shared lock is held on the new element's model and parent element.\n */\n checkSharedLock(id: Id64String, type: string, operation: string): void;\n\n /**\n * Determine whether the owning iModel currently holds the exclusive lock on the specified element.\n */\n holdsExclusiveLock(id: Id64String): boolean;\n\n /**\n * Determine whether the owning iModel currently holds a shared lock on the specified element.\n */\n holdsSharedLock(id: Id64String): boolean;\n\n /**\n * Acquire locks on one or more elements from the lock server, if required and not already held.\n * If any required lock is not available, this method throws an exception and *none* of the requested locks are acquired.\n * @note Acquiring the exclusive lock on an element requires also obtaining a shared lock on all its owner elements. This method will\n * attempt to acquire all necessary locks for both sets of input ids.\n * @note Calling this method after reversing or reinstating a Txn indicates the start of a brand new Txn with the current Txn ID,\n * making it invalid to call [[abandonLocksForReversedTxn]] or [[acquireLocksForReinstatingTxn]] for previously-reversed\n * Txns with the current ID or greater.\n */\n acquireLocks(arg: {\n /** if present, one or more elements to obtain shared lock */\n shared?: Id64Arg;\n /** if present, one or more elements to obtain exclusive lock */\n exclusive?: Id64Arg;\n }): Promise<void>;\n\n /** Release all locks currently held by this briefcase from the lock server after editing the associated elements.\n * This is typically done on your behalf by [[BriefcaseDb.pushChanges]].\n * If you are abandoning changes instead of pushing them, you should call [[abandonAllLocks]] instead.\n * You may want to do it manually when abandoning all of your briefcase's local changes.\n * You cannot release your locks if your briefcase contains local changes.\n * @throws Error if the briefcase has local changes, or if any other error occurs while releasing the locks.\n */\n releaseAllLocks(): Promise<void>;\n\n /**\n * Abandons all locks currently held by this briefcase when none of the associated elements have\n * been or will be modified. This is only valid to do when none of the elements protected by\n * the currently-held locks have been edited, or if all edits have been reversed or abandoned without\n * pushing them.\n * @beta\n *\n * The locks are released on the IModelHub, but the changeset associated with the locks is not updated,\n * reflecting the fact that the associated elements were not edited.\n */\n abandonAllLocks(): Promise<void>;\n\n /**\n * Release all locks currently held by this Briefcase from the lock server.\n * Not possible to release locks unless push or abandon all changes. Should only be called internally.\n * @internal\n */\n [_releaseAllLocks]: () => Promise<void>;\n\n /**\n * Abandons the locks that were acquired during a given Txn and all later Txns, all of which must already\n * have been reversed.\n * @beta\n *\n * @param txnId The ID of the first Txn whose locks should be abandoned. This must either be a Txn that has\n * already been reversed, or the [[TxnManager.getCurrentTxnId]]. In either case, the current Txn must not\n * have any unsaved changes.\n * @returns A promise that resolves to true if any locks were successfully abandoned. False if there were no locks to abandon,\n * which may be the case if the Txns did not acquire any locks or if they were already abandoned. The Promise rejects\n * with an ITwinError if the Txn has not been reversed, the current Txn has unsaved changes, or if any other error occurs\n * while releasing the locks.\n * @note This method also implicitly calls [[abandonLocksForCurrentUnsavedTxn]]. Locks acquired in the current,\n * unsaved Txn will be abandoned when calling this method. However, they can not be re-acquired using\n * [[acquireLocksForReinstatingTxn]]. This is because there is no way to recover these unsaved changes after abandoning\n * them, so it is rarely useful to re-acquire the locks associated with irrecoverable changes.\n */\n abandonLocksForReversedTxn(txnId: Id64String): Promise<boolean>;\n\n /**\n * Abandons the locks that were acquired during the current, unsaved Txn. Any changes in the unsaved Txn must be abandoned\n * before calling this method.\n * @beta\n *\n * @returns A promise that resolves to true if any locks were successfully abandoned. False if there were no locks to abandon,\n * which may be the case if the current Txn did not acquire any locks or if they were already abandoned. The Promise rejects\n * with an ITwinError if the current Txn has unsaved changes, or if any other error occurs while releasing the locks.\n */\n abandonLocksForCurrentUnsavedTxn(): Promise<boolean>;\n\n /**\n * Re-acquire the locks that were previously acquired during a given Txn and all previous Txns. These locks are\n * expected to have previously been released with {@link LockControl.abandonLocksForReversedTxn}. This is used\n * just before reinstating a previously-reversed Txn to ensure that the necessary locks are held for the\n * reinstated changes.\n * @beta\n *\n * It is possible that the locks may no longer be available, in which case the returned Promise will reject\n * with an exception.\n *\n * @param txnId The ID of the last Txn whose locks should be re-acquired.\n * @returns A promise that resolves to true if any locks were successfully acquired. False if there were no locks to acquire,\n * which may be the case if the Txn in question did not acquire any locks or if they were already re-acquired. The Promise\n * rejects with an ITwinError if the Txn does not exist, the current Txn has unsaved changes, the locks cannot be acquired,\n * or if any other error occurs while acquiring the locks.\n */\n acquireLocksForReinstatingTxn(txnId: Id64String): Promise<boolean>;\n\n /**\n * Checks whether the locks originally acquired for a specified reversed Txn, and all earlier Txns, were either not abandoned\n * or have already been re-acquired.\n * @beta\n *\n * If this method returns true, it is safe to reinstate the given Txn with [[TxnManager.reinstateTxn]]. If it returns false,\n * the necessary locks must be acquired first, either by calling [[TxnManager.reinstateTxnAsync]] or by explicitly calling\n * [[acquireLocksForReinstatingTxn]] first.\n *\n * @param txnId The ID of the Txn to check.\n * @returns True if the necessary locks are currently held, false otherwise.\n */\n holdsNecessaryLocksForReinstatingTxn(txnId: Id64String): boolean;\n\n /**\n * Clears the records of locks acquired for a given Txn and all later Txns from the local lock database. Call this after\n * a Txn becomes unreachable. This allows an ID to potentially be reused for a different Txn in the future.\n * @beta\n *\n * After invoking this method, {@link LockControl.abandonLocksForReversedTxn} and {@link LockControl.acquireLocksForReinstatingTxn} will no\n * longer be able to operate on this Txn or any later Txns.\n *\n * @param txnId The ID of the first Txn whose lock records should be cleared.\n */\n clearTxnLockRecords(txnId: Id64String): void;\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * @module iModels
3
3
  */
4
4
  import { BeEvent, DbConflictResolution, DbResult, Id64String, IModelStatus } from "@itwin/core-bentley";
5
- import { ChangesetIdWithIndex, ChangesetIndexAndId, ChangesetProps, EntityIdAndClassIdIterable, ModelGeometryChangesProps, ModelIdAndGeometryGuid, TxnProps } from "@itwin/core-common";
5
+ import { ChangesetIdWithIndex, ChangesetIndexAndId, ChangesetProps, EntityIdAndClassIdIterable, ModelGeometryChangesProps, ModelIdAndGeometryGuid, ReinstateTxnArgs, ReverseTxnArgs, TxnProps } from "@itwin/core-common";
6
6
  import { BriefcaseDb } from "./IModelDb";
7
7
  import { RelationshipProps } from "./Relationship";
8
8
  import { DbRebaseChangesetConflictArgs, RebaseChangesetConflictArgs } from "./internal/ChangesetConflictArgs";
@@ -482,6 +482,7 @@ export declare class TxnManager {
482
482
  /** Return the depth of the multi-Txn stack. Generally for diagnostic use only. */
483
483
  getMultiTxnOperationDepth(): number;
484
484
  /** Reverse (undo) the most recent operation(s) to this IModelDb.
485
+ * @note Consider using [[reverseTxnsAsync]] instead.
485
486
  * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will
486
487
  * be reinstated together when/if ReinstateTxn is called.
487
488
  * @note If there are any outstanding uncommitted changes, they are reversed.
@@ -490,27 +491,122 @@ export declare class TxnManager {
490
491
  * @note If numOperations is too large only the operations are reversible are reversed.
491
492
  */
492
493
  reverseTxns(numOperations: number): IModelStatus;
493
- /** Reverse the most recent operation. */
494
+ /** Reverse the most recent operation.
495
+ * @note Consider using [[reverseSingleTxnAsync]] instead.
496
+ */
494
497
  reverseSingleTxn(): IModelStatus;
495
- /** Reverse all changes back to the beginning of the session. */
498
+ /** Reverse all changes back to the beginning of the session.
499
+ * @note Consider using [[reverseAllTxnsAsync]] instead.
500
+ */
496
501
  reverseAll(): IModelStatus;
497
502
  /** Reverse all changes back to a previously saved TxnId.
503
+ * @note Consider using [[reverseToTxnAsync]] instead.
498
504
  * @param txnId a TxnId obtained from a previous call to GetCurrentTxnId.
499
505
  * @returns Success if the transactions were reversed, error status otherwise.
500
506
  * @see [[getCurrentTxnId]] [[cancelTo]]
501
507
  */
502
508
  reverseTo(txnId: TxnIdString): IModelStatus;
503
509
  /** Reverse and then cancel (make non-reinstatable) all changes back to a previous TxnId.
510
+ * @note Consider using [[cancelToTxnAsync]] instead.
504
511
  * @param txnId a TxnId obtained from a previous call to [[getCurrentTxnId]]
505
512
  * @returns Success if the transactions were reversed and cleared, error status otherwise.
506
513
  */
507
514
  cancelTo(txnId: TxnIdString): IModelStatus;
515
+ /** Reverse (undo) the most recent operation(s) to this IModelDb. By default, this method also
516
+ * abandons the locks that were acquired for those operations.
517
+ * @beta
518
+ * @note This method will also abandon locks associated with any later, reversed Txns, if they have not
519
+ * already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
520
+ * its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
521
+ * with _both_ Txn 1 and Txn 2.
522
+ * @note If you do not want to abandon any locks, set [ReverseTxnArgs.retainLocks]($common) to true.
523
+ * @note If there are any outstanding uncommitted changes, they are reversed.
524
+ * @note The term "operation" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,
525
+ * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.
526
+ * @note If numOperations is too large only the operations are reversible are reversed.
527
+ * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will
528
+ * be reinstated together when/if ReinstateTxn is called.
529
+ * @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.
530
+ * @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.
531
+ */
532
+ reverseTxnsAsync(numOperations: number, args?: ReverseTxnArgs): Promise<void>;
533
+ /** Reverse (undo) the most recent operation to this IModelDb. By default, this method also
534
+ * abandons the locks that were acquired for that operation.
535
+ * @beta
536
+ * @note This method will also abandon locks associated with any later, reversed Txns, if they have not
537
+ * already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
538
+ * its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
539
+ * with _both_ Txn 1 and Txn 2.
540
+ * @note If there are any outstanding uncommitted changes, they are reversed.
541
+ * @note The term "operation" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,
542
+ * even though this method reverses only one operation, multiple Txns may be reversed if they were grouped together when they were made.
543
+ * @note If there are no reversible operations, this method does nothing and returns Success.
544
+ * @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.
545
+ * @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.
546
+ */
547
+ reverseSingleTxnAsync(args?: ReverseTxnArgs): Promise<void>;
548
+ /** Reverse (undo) all operations back to the beginning of the session. By default, this method also
549
+ * abandons the locks that were acquired for those operations.
550
+ * @beta
551
+ * @note This method will also abandon locks associated with any later, reversed Txns, if they have not
552
+ * already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
553
+ * its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
554
+ * with _both_ Txn 1 and Txn 2.
555
+ * @note If there are any outstanding uncommitted changes, they are reversed.
556
+ * @note If there are no reversible operations, this method does nothing and returns Success.
557
+ * @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.
558
+ * @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.
559
+ */
560
+ reverseAllTxnsAsync(args?: ReverseTxnArgs): Promise<void>;
561
+ /** Reverse (undo) all operations back to a previously saved TxnId. By default, this method also
562
+ * abandons the locks that were acquired for those operations.
563
+ * @beta
564
+ * @note This method will also abandon locks associated with any later, reversed Txns, if they have not
565
+ * already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
566
+ * its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
567
+ * with _both_ Txn 1 and Txn 2.
568
+ * @note If there are any outstanding uncommitted changes, they are reversed.
569
+ * @param txnId a TxnId obtained from a previous call to GetCurrentTxnId.
570
+ * @param args Optional arguments to control the behavior of the reverse operation, such as whether to abandon locks.
571
+ * @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.
572
+ * @see [[getCurrentTxnId]] [[cancelTo]]
573
+ */
574
+ reverseToTxnAsync(txnId: TxnIdString, args?: ReverseTxnArgs): Promise<void>;
575
+ /** Reverse and then cancel (make non-reinstatable) all operations back to a previous TxnId. By default, this
576
+ * method also abandons the locks that were acquired for those operations.
577
+ * @beta
578
+ * @note This method will also abandon locks associated with any later, reversed Txns, if they have not
579
+ * already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
580
+ * its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
581
+ * with _both_ Txn 1 and Txn 2.
582
+ * @note If there are any outstanding uncommitted changes, they are reversed.
583
+ * @param txnId a TxnId obtained from a previous call to [[getCurrentTxnId]]
584
+ * @param args Optional arguments to control the behavior of the reverse operation, such as whether to abandon locks.
585
+ * @returns A promise that resolves to success if the transactions were reversed and cleared, or rejects with an IModelError otherwise.
586
+ */
587
+ cancelToTxnAsync(txnId: TxnIdString, args?: ReverseTxnArgs): Promise<void>;
588
+ private withLockAbandonment;
508
589
  /** Reinstate the most recently reversed transaction. Since at any time multiple transactions can be reversed, it
509
590
  * may take multiple calls to this method to reinstate all reversed operations.
510
591
  * @returns Success if a reversed transaction was reinstated, error status otherwise.
511
592
  * @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.
593
+ * @note This method will return [[IModelStatus.LockNotHeld]] and will not reinstate the Txn if the locks
594
+ * originally acquired by the Txn have been abandoned. Use [[reinstateTxnAsync]] to re-acquire the locks
595
+ * and reinstate the Txn in a single operation.
512
596
  */
513
597
  reinstateTxn(): IModelStatus;
598
+ /** Reinstate the most recently reversed transaction. This method will first attempt
599
+ * to re-acquire the required locks, if they were abandoned after the operation was reversed.
600
+ * Since at any time multiple transactions can be reversed, it may take multiple calls to this
601
+ * method to reinstate all reversed operations.
602
+ * @beta
603
+ * @note If there are any outstanding unsaved changes, they are canceled before the Txn is reinstated. Unless
604
+ * [ReinstateTxnArgs.retainLocks]($common) is true, the locks associated with the unsaved changes are also abandoned.
605
+ * @param args Optional arguments to control the behavior of the reinstate operation, such as whether to retain
606
+ * locks when abandoning unsaved changes.
607
+ * @returns A Promise that resolves to success if a reversed transaction was reinstated, or rejects with an IModelError otherwise.
608
+ */
609
+ reinstateTxnAsync(args?: ReinstateTxnArgs): Promise<void>;
514
610
  /** Get the Id of the first transaction, if any.
515
611
  */
516
612
  queryFirstTxnId(): TxnIdString;
@@ -551,7 +647,7 @@ export declare class TxnManager {
551
647
  get hasLocalChanges(): boolean;
552
648
  /** Destroy the record of all local changes that have yet to be saved and/or pushed.
553
649
  * This permanently eradicates your changes - use with caution!
554
- * Typically, callers will want to subsequently use [[LockControl.releaseAllLocks]].
650
+ * Typically, callers will want to subsequently use [[LockControl.abandonAllLocks]].
555
651
  * After calling this function, [[hasLocalChanges]], [[hasPendingTxns]], and [[hasUnsavedChanges]] will all be `false`.
556
652
  */
557
653
  deleteAllTx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