@itwin/core-frontend 4.7.0-dev.9 → 4.8.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Change Log - @itwin/core-frontend
2
2
 
3
- This log was last generated on Wed, 15 May 2024 21:32:22 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 29 May 2024 14:36:43 GMT and should not be manually modified.
4
+
5
+ ## 4.6.1
6
+ Wed, 29 May 2024 14:35:17 GMT
7
+
8
+ _Version update only_
4
9
 
5
10
  ## 4.6.0
6
11
  Mon, 13 May 2024 20:32:51 GMT
@@ -32,10 +32,10 @@ class CheckpointConnection extends IModelConnection_1.IModelConnection {
32
32
  super(props);
33
33
  this._reopenConnectionHandler = async (request, response, resubmit, reject) => {
34
34
  if (!response.hasOwnProperty("isIModelNotFoundResponse"))
35
- return;
35
+ reject();
36
36
  const iModelRpcProps = request.parameters[0];
37
37
  if (this._fileKey !== iModelRpcProps.key)
38
- return; // The handler is called for a different connection than this
38
+ reject(); // The handler is called for a different connection than this
39
39
  core_bentley_1.Logger.logTrace(loggerCategory, "Attempting to reopen connection", () => iModelRpcProps);
40
40
  try {
41
41
  const openResponse = await CheckpointConnection.callOpen(iModelRpcProps, this.routingContext);
@@ -1 +1 @@
1
- {"version":3,"file":"CheckpointConnection.js","sourceRoot":"","sources":["../../src/CheckpointConnection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsF;AACtF,oDAG4B;AAC5B,4EAAyE;AACzE,2CAAwC;AACxC,yDAAsD;AACtD,iEAA8D;AAC9D,qCAAkC;AAElC,MAAM,cAAc,GAAG,+CAAsB,CAAC,gBAAgB,CAAC;AAE/D;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,mCAAgB;IAGxD,gEAAgE;IAChE,IAAoB,OAAO,KAAiB,OAAO,KAAK,CAAC,OAAQ,CAAC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Ac,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;;YAEvD,wBAAU,CAAC,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAE5E,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF;AApID,oDAoIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelConnection\r\n */\r\n\r\nimport { BentleyError, BentleyStatus, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n IModelConnectionProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelVersion, RpcManager, RpcNotFoundResponse, RpcOperation,\r\n RpcRequest, RpcRequestEvent,\r\n} from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { IModelRoutingContext } from \"./IModelRoutingContext\";\r\nimport { IpcApp } from \"./IpcApp\";\r\n\r\nconst loggerCategory = FrontendLoggerCategory.IModelConnection;\r\n\r\n/**\r\n * An IModelConnection to a Checkpoint of an iModel.\r\n * @see [CheckpointConnection]($docs/learning/frontend/IModelConnection)\r\n * @public\r\n */\r\nexport class CheckpointConnection extends IModelConnection {\r\n private readonly _fromIpc: boolean;\r\n\r\n /** The Guid that identifies the iTwin that owns this iModel. */\r\n public override get iTwinId(): GuidString { return super.iTwinId!; }\r\n /** The Guid that identifies this iModel. */\r\n public override get iModelId(): GuidString { return super.iModelId!; }\r\n\r\n /** Returns `true` if [[close]] has already been called. */\r\n public get isClosed(): boolean { return this._isClosed ? true : false; }\r\n protected _isClosed?: boolean;\r\n\r\n protected constructor(props: IModelConnectionProps, fromIpc: boolean) {\r\n super(props);\r\n this._fromIpc = fromIpc;\r\n }\r\n\r\n /** Type guard for instanceof [[CheckpointConnection]] */\r\n public override isCheckpointConnection(): this is CheckpointConnection { return true; }\r\n\r\n /**\r\n * Open a readonly IModelConnection to a Checkpoint of an iModel.\r\n */\r\n public static async openRemote(iTwinId: GuidString, iModelId: GuidString, version = IModelVersion.latest()): Promise<CheckpointConnection> {\r\n if (undefined === IModelApp.hubAccess)\r\n throw new Error(\"Missing an implementation of IModelApp.hubAccess\");\r\n\r\n const accessToken = await IModelApp.getAccessToken();\r\n const changeset = await IModelApp.hubAccess.getChangesetFromVersion({ accessToken, iModelId, version });\r\n\r\n let connection: CheckpointConnection;\r\n const iModelProps = { iTwinId, iModelId, changeset };\r\n if (IpcApp.isValid) {\r\n connection = new this(await IpcApp.appFunctionIpc.openCheckpoint(iModelProps), true);\r\n } else {\r\n const routingContext = IModelRoutingContext.current || IModelRoutingContext.default;\r\n connection = new this(await this.callOpen(iModelProps, routingContext), false);\r\n RpcManager.setIModel(connection);\r\n connection.routingContext = routingContext;\r\n RpcRequest.notFoundHandlers.addListener(connection._reopenConnectionHandler);\r\n }\r\n\r\n IModelConnection.onOpen.raiseEvent(connection);\r\n return connection;\r\n }\r\n\r\n private static async callOpen(iModelToken: IModelRpcOpenProps, routingContext: IModelRoutingContext): Promise<IModelConnectionProps> {\r\n // Try opening the iModel repeatedly accommodating any pending responses from the backend.\r\n // Waits for an increasing amount of time (but within a range) before checking on the pending request again.\r\n const connectionRetryIntervalRange = { min: 100, max: 5000 }; // in milliseconds\r\n let connectionRetryInterval = Math.min(connectionRetryIntervalRange.min, IModelConnection.connectionTimeout);\r\n\r\n const openForReadOperation = RpcOperation.lookup(IModelReadRpcInterface, \"getConnectionProps\");\r\n if (!openForReadOperation)\r\n throw new IModelError(BentleyStatus.ERROR, \"IModelReadRpcInterface.getConnectionProps() is not available\");\r\n openForReadOperation.policy.retryInterval = () => connectionRetryInterval;\r\n\r\n Logger.logTrace(loggerCategory, `IModelConnection.open`, iModelToken);\r\n const startTime = Date.now();\r\n\r\n const removeListener = RpcRequest.events.addListener((type: RpcRequestEvent, request: RpcRequest) => { // eslint-disable-line deprecation/deprecation\r\n if (type !== RpcRequestEvent.PendingUpdateReceived) // eslint-disable-line deprecation/deprecation\r\n return;\r\n if (!(openForReadOperation && request.operation === openForReadOperation))\r\n return;\r\n\r\n Logger.logTrace(loggerCategory, \"Received pending open notification in IModelConnection.open\", iModelToken);\r\n\r\n const connectionTimeElapsed = Date.now() - startTime;\r\n if (connectionTimeElapsed > IModelConnection.connectionTimeout) {\r\n Logger.logError(loggerCategory, `Timed out opening connection in IModelConnection.open (took longer than ${IModelConnection.connectionTimeout} milliseconds)`, iModelToken);\r\n throw new IModelError(BentleyStatus.ERROR, \"Opening a connection was timed out\"); // NEEDS_WORK: More specific error status\r\n }\r\n\r\n connectionRetryInterval = Math.min(connectionRetryIntervalRange.max, connectionRetryInterval * 2, IModelConnection.connectionTimeout - connectionTimeElapsed);\r\n if (request.retryInterval !== connectionRetryInterval) {\r\n request.retryInterval = connectionRetryInterval;\r\n Logger.logTrace(loggerCategory, `Adjusted open connection retry interval to ${request.retryInterval} milliseconds in IModelConnection.open`, iModelToken);\r\n }\r\n });\r\n\r\n const openPromise = IModelReadRpcInterface.getClientForRouting(routingContext.token).getConnectionProps(iModelToken);\r\n let openResponse: IModelConnectionProps;\r\n try {\r\n openResponse = await openPromise;\r\n } finally {\r\n Logger.logTrace(loggerCategory, \"Completed open request in IModelConnection.open\", iModelToken);\r\n removeListener();\r\n }\r\n\r\n return openResponse;\r\n }\r\n\r\n private _reopenConnectionHandler = async (request: RpcRequest<RpcNotFoundResponse>, response: any, resubmit: () => void, reject: (reason: any) => void) => { // eslint-disable-line deprecation/deprecation\r\n if (!response.hasOwnProperty(\"isIModelNotFoundResponse\"))\r\n return;\r\n\r\n const iModelRpcProps = request.parameters[0];\r\n if (this._fileKey !== iModelRpcProps.key)\r\n return; // The handler is called for a different connection than this\r\n\r\n Logger.logTrace(loggerCategory, \"Attempting to reopen connection\", () => iModelRpcProps);\r\n\r\n try {\r\n const openResponse = await CheckpointConnection.callOpen(iModelRpcProps, this.routingContext);\r\n // The new/reopened connection may have a new rpcKey and/or changesetId, but the other IModelRpcTokenProps should be the same\r\n this._fileKey = openResponse.key;\r\n this.changeset = openResponse.changeset!;\r\n\r\n } catch (error) {\r\n reject(BentleyError.getErrorMessage(error));\r\n } finally {\r\n }\r\n\r\n Logger.logTrace(loggerCategory, \"Resubmitting original request after reopening connection\", iModelRpcProps);\r\n request.parameters[0] = this.getRpcProps(); // Modify the token of the original request before resubmitting it.\r\n resubmit();\r\n };\r\n\r\n /** Close this CheckpointConnection */\r\n public async close(): Promise<void> {\r\n if (this.isClosed)\r\n return;\r\n\r\n this.beforeClose();\r\n if (this._fromIpc)\r\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\r\n else\r\n RpcRequest.notFoundHandlers.removeListener(this._reopenConnectionHandler);\r\n\r\n this._isClosed = true;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CheckpointConnection.js","sourceRoot":"","sources":["../../src/CheckpointConnection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsF;AACtF,oDAG4B;AAC5B,4EAAyE;AACzE,2CAAwC;AACxC,yDAAsD;AACtD,iEAA8D;AAC9D,qCAAkC;AAElC,MAAM,cAAc,GAAG,+CAAsB,CAAC,gBAAgB,CAAC;AAE/D;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,mCAAgB;IAGxD,gEAAgE;IAChE,IAAoB,OAAO,KAAiB,OAAO,KAAK,CAAC,OAAQ,CAAC,CAAC,CAAC;IACpE,4CAA4C;IAC5C,IAAoB,QAAQ,KAAiB,OAAO,KAAK,CAAC,QAAS,CAAC,CAAC,CAAC;IAEtE,2DAA2D;IAC3D,IAAW,QAAQ,KAAc,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAA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AC;CACF;AApID,oDAoIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelConnection\r\n */\r\n\r\nimport { BentleyError, BentleyStatus, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n IModelConnectionProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelVersion, RpcManager, RpcNotFoundResponse, RpcOperation,\r\n RpcRequest, RpcRequestEvent,\r\n} from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { IModelRoutingContext } from \"./IModelRoutingContext\";\r\nimport { IpcApp } from \"./IpcApp\";\r\n\r\nconst loggerCategory = FrontendLoggerCategory.IModelConnection;\r\n\r\n/**\r\n * An IModelConnection to a Checkpoint of an iModel.\r\n * @see [CheckpointConnection]($docs/learning/frontend/IModelConnection)\r\n * @public\r\n */\r\nexport class CheckpointConnection extends IModelConnection {\r\n private readonly _fromIpc: boolean;\r\n\r\n /** The Guid that identifies the iTwin that owns this iModel. */\r\n public override get iTwinId(): GuidString { return super.iTwinId!; }\r\n /** The Guid that identifies this iModel. */\r\n public override get iModelId(): GuidString { return super.iModelId!; }\r\n\r\n /** Returns `true` if [[close]] has already been called. */\r\n public get isClosed(): boolean { return this._isClosed ? true : false; }\r\n protected _isClosed?: boolean;\r\n\r\n protected constructor(props: IModelConnectionProps, fromIpc: boolean) {\r\n super(props);\r\n this._fromIpc = fromIpc;\r\n }\r\n\r\n /** Type guard for instanceof [[CheckpointConnection]] */\r\n public override isCheckpointConnection(): this is CheckpointConnection { return true; }\r\n\r\n /**\r\n * Open a readonly IModelConnection to a Checkpoint of an iModel.\r\n */\r\n public static async openRemote(iTwinId: GuidString, iModelId: GuidString, version = IModelVersion.latest()): Promise<CheckpointConnection> {\r\n if (undefined === IModelApp.hubAccess)\r\n throw new Error(\"Missing an implementation of IModelApp.hubAccess\");\r\n\r\n const accessToken = await IModelApp.getAccessToken();\r\n const changeset = await IModelApp.hubAccess.getChangesetFromVersion({ accessToken, iModelId, version });\r\n\r\n let connection: CheckpointConnection;\r\n const iModelProps = { iTwinId, iModelId, changeset };\r\n if (IpcApp.isValid) {\r\n connection = new this(await IpcApp.appFunctionIpc.openCheckpoint(iModelProps), true);\r\n } else {\r\n const routingContext = IModelRoutingContext.current || IModelRoutingContext.default;\r\n connection = new this(await this.callOpen(iModelProps, routingContext), false);\r\n RpcManager.setIModel(connection);\r\n connection.routingContext = routingContext;\r\n RpcRequest.notFoundHandlers.addListener(connection._reopenConnectionHandler);\r\n }\r\n\r\n IModelConnection.onOpen.raiseEvent(connection);\r\n return connection;\r\n }\r\n\r\n private static async callOpen(iModelToken: IModelRpcOpenProps, routingContext: IModelRoutingContext): Promise<IModelConnectionProps> {\r\n // Try opening the iModel repeatedly accommodating any pending responses from the backend.\r\n // Waits for an increasing amount of time (but within a range) before checking on the pending request again.\r\n const connectionRetryIntervalRange = { min: 100, max: 5000 }; // in milliseconds\r\n let connectionRetryInterval = Math.min(connectionRetryIntervalRange.min, IModelConnection.connectionTimeout);\r\n\r\n const openForReadOperation = RpcOperation.lookup(IModelReadRpcInterface, \"getConnectionProps\");\r\n if (!openForReadOperation)\r\n throw new IModelError(BentleyStatus.ERROR, \"IModelReadRpcInterface.getConnectionProps() is not available\");\r\n openForReadOperation.policy.retryInterval = () => connectionRetryInterval;\r\n\r\n Logger.logTrace(loggerCategory, `IModelConnection.open`, iModelToken);\r\n const startTime = Date.now();\r\n\r\n const removeListener = RpcRequest.events.addListener((type: RpcRequestEvent, request: RpcRequest) => { // eslint-disable-line deprecation/deprecation\r\n if (type !== RpcRequestEvent.PendingUpdateReceived) // eslint-disable-line deprecation/deprecation\r\n return;\r\n if (!(openForReadOperation && request.operation === openForReadOperation))\r\n return;\r\n\r\n Logger.logTrace(loggerCategory, \"Received pending open notification in IModelConnection.open\", iModelToken);\r\n\r\n const connectionTimeElapsed = Date.now() - startTime;\r\n if (connectionTimeElapsed > IModelConnection.connectionTimeout) {\r\n Logger.logError(loggerCategory, `Timed out opening connection in IModelConnection.open (took longer than ${IModelConnection.connectionTimeout} milliseconds)`, iModelToken);\r\n throw new IModelError(BentleyStatus.ERROR, \"Opening a connection was timed out\"); // NEEDS_WORK: More specific error status\r\n }\r\n\r\n connectionRetryInterval = Math.min(connectionRetryIntervalRange.max, connectionRetryInterval * 2, IModelConnection.connectionTimeout - connectionTimeElapsed);\r\n if (request.retryInterval !== connectionRetryInterval) {\r\n request.retryInterval = connectionRetryInterval;\r\n Logger.logTrace(loggerCategory, `Adjusted open connection retry interval to ${request.retryInterval} milliseconds in IModelConnection.open`, iModelToken);\r\n }\r\n });\r\n\r\n const openPromise = IModelReadRpcInterface.getClientForRouting(routingContext.token).getConnectionProps(iModelToken);\r\n let openResponse: IModelConnectionProps;\r\n try {\r\n openResponse = await openPromise;\r\n } finally {\r\n Logger.logTrace(loggerCategory, \"Completed open request in IModelConnection.open\", iModelToken);\r\n removeListener();\r\n }\r\n\r\n return openResponse;\r\n }\r\n\r\n private _reopenConnectionHandler = async (request: RpcRequest<RpcNotFoundResponse>, response: any, resubmit: () => void, reject: (reason?: any) => void) => {\r\n if (!response.hasOwnProperty(\"isIModelNotFoundResponse\"))\r\n reject();\r\n\r\n const iModelRpcProps = request.parameters[0];\r\n if (this._fileKey !== iModelRpcProps.key)\r\n reject(); // The handler is called for a different connection than this\r\n\r\n Logger.logTrace(loggerCategory, \"Attempting to reopen connection\", () => iModelRpcProps);\r\n\r\n try {\r\n const openResponse = await CheckpointConnection.callOpen(iModelRpcProps, this.routingContext);\r\n // The new/reopened connection may have a new rpcKey and/or changesetId, but the other IModelRpcTokenProps should be the same\r\n this._fileKey = openResponse.key;\r\n this.changeset = openResponse.changeset!;\r\n\r\n } catch (error) {\r\n reject(BentleyError.getErrorMessage(error));\r\n } finally {\r\n }\r\n\r\n Logger.logTrace(loggerCategory, \"Resubmitting original request after reopening connection\", iModelRpcProps);\r\n request.parameters[0] = this.getRpcProps(); // Modify the token of the original request before resubmitting it.\r\n resubmit();\r\n };\r\n\r\n /** Close this CheckpointConnection */\r\n public async close(): Promise<void> {\r\n if (this.isClosed)\r\n return;\r\n\r\n this.beforeClose();\r\n if (this._fromIpc)\r\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\r\n else\r\n RpcRequest.notFoundHandlers.removeListener(this._reopenConnectionHandler);\r\n\r\n this._isClosed = true;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SubCategoriesCache.d.ts","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAuB,MAAM,qBAAqB,CAAC;AACzH,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,8EAA8E;IAC9E,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,2BAA2B;IAC3B,MAAM,IAAI,IAAI,CAAC;CAChB;AAID;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4C;IACzE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,uBAAuB,CAAsB;gBAElC,MAAM,EAAE,gBAAgB;IAE3C,wIAAwI;IACjI,gBAAgB,CAAC,UAAU,EAAE,MAA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,EAAE,CAAC;IAE5C,MAAa,OAAO;QAClB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;QAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2B;QACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;QACtC,OAAO,CAAC,SAAS,CAAS;QAC1B,OAAO,CAAC,oBAAoB,CAAK;QAEjC,IAAW,WAAW,YAAsD;oBAEzD,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,SAAO;QAY5F,MAAM;QAEA,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;KA2BrD;IAED,KAAY,SAAS,GAAG,MAAM,IAAI,CAAC;IAEnC,MAAa,UAAU;QACrB,SAAgB,WAAW,EAAE,OAAO,CAAC;QACrC,SAAgB,KAAK,EAAE,SAAS,EAAE,CAAC;oBAEhB,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;KAIzD;IAED;;;;;OAKG;IACH,MAAa,KAAK;QAEhB,SAAS,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;QAChC,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;QAC7B,SAAS,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;QAC1C,SAAS,CAAC,SAAS,UAAS;QAE5B;;WAEG;QACI,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;QASnF,+CAA+C;QACxC,OAAO,IAAI,IAAI;QAWtB,IAAW,OAAO,IAAI,OAAO,CAE5B;QAED,OAAO,CAAC,WAAW;QAgBnB,OAAO,CAAC,cAAc;QAoCtB,OAAO,CAAC,QAAQ;KAgBjB;CACF"}
@@ -126,7 +126,7 @@ exports.SubCategoriesCache = SubCategoriesCache;
126
126
  (function (SubCategoriesCache) {
127
127
  class Request {
128
128
  get wasCanceled() { return this._canceled || this._imodel.isClosed; }
129
- constructor(categoryIds, imodel, maxCategoriesPerQuery = 200) {
129
+ constructor(categoryIds, imodel, maxCategoriesPerQuery = 2500) {
130
130
  this._categoryIds = [];
131
131
  this._result = [];
132
132
  this._canceled = false;
@@ -1 +1 @@
1
- {"version":3,"file":"SubCategoriesCache.js","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAyH;AACzH,oDAAiF;AAkBjF,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjD;;GAEG;AACH,MAAa,kBAAkB;IAM7B,YAAmB,MAAwB;QAL1B,kBAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;QAC3C,iBAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;QAI1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAAC,CAAC;IAEvE,wIAAwI;IACjI,gBAAgB,CAAC,UAAkB,IAAyB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/G,wHAAwH;IACjH,wBAAwB,CAAC,aAAyB,IAAuC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAEzJ;;;;OAIG;IACI,IAAI,CAAC,WAAoB;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC7C,IAAI,SAAS,KAAK,OAAO;YACvB,OAAO,SAAS,CAAC;QAEnB,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtE,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,MAAkC,EAAE,EAAE;YAC7E,IAAI,SAAS,KAAK,MAAM;gBACtB,IAAI,CAAC,cAAc,CAA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,IAAI,UAAU,CAAC,mBAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACrE,CAAC;iBAAM,CAAC;gBACN,mGAAmG;gBACnG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5B,KAAK,MAAM,UAAU,IAAI,mBAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;oBACjD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;KACF;IAvGY,wBAAK,QAuGjB,CAAA;AACH,CAAC,EAjLgB,kBAAkB,kCAAlB,kBAAkB,QAiLlC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { assert, CompressedId64Set, Id64, Id64Arg, Id64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { SubCategoryAppearance, SubCategoryResultRow } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** A cancelable paginated request for subcategory information.\r\n * @see SubCategoriesCache\r\n * @internal\r\n */\r\nexport interface SubCategoriesRequest {\r\n /** The Ids of any categories which were requested but were not yet loaded. */\r\n readonly missingCategoryIds: Id64Set;\r\n /** A promise which resolves to true when all of the requested categories have been loaded, or to false if not all categories were loaded.\r\n * Categories may fail to load if the request is explicitly canceled or if the IModelConnection is closed before all categories are loaded.\r\n */\r\n readonly promise: Promise<boolean>;\r\n /** Cancels the request. */\r\n cancel(): void;\r\n}\r\n\r\nconst invalidCategoryIdEntry = new Set<string>();\r\n\r\n/** A cache of information about the subcategories contained within an [[IModelConnection]]. It is populated on demand.\r\n * @internal\r\n */\r\nexport class SubCategoriesCache {\r\n private readonly _byCategoryId = new Map<string, Id64Set>();\r\n private readonly _appearances = new Map<string, SubCategoryAppearance>();\r\n private readonly _imodel: IModelConnection;\r\n private _missingAtTimeOfPreload: Id64Set | undefined;\r\n\r\n public constructor(imodel: IModelConnection) { this._imodel = imodel; }\r\n\r\n /** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */\r\n public getSubCategories(categoryId: string): Id64Set | undefined { return this._byCategoryId.get(categoryId); }\r\n\r\n /** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */\r\n public getSubCategoryAppearance(subCategoryId: Id64String): SubCategoryAppearance | undefined { return this._appearances.get(subCategoryId.toString()); }\r\n\r\n /** Request that the subcategory information for all of the specified categories is loaded.\r\n * If all such information has already been loaded, returns undefined.\r\n * Otherwise, dispatches an asynchronous request to load those categories which are not already loaded and returns a cancellable request object\r\n * containing the corresponding promise and the set of categories still to be loaded.\r\n */\r\n public load(categoryIds: Id64Arg): SubCategoriesRequest | undefined {\r\n const missing = this.getMissing(categoryIds);\r\n if (undefined === missing)\r\n return undefined;\r\n\r\n const request = new SubCategoriesCache.Request(missing, this._imodel);\r\n const promise = request.dispatch().then((result?: SubCategoriesCache.Result) => {\r\n if (undefined !== result)\r\n this.processResults(result, missing);\r\n\r\n return !request.wasCanceled;\r\n });\r\n\r\n return {\r\n missingCategoryIds: missing,\r\n promise,\r\n cancel: () => request.cancel(),\r\n };\r\n }\r\n\r\n /** Given categoryIds, return which of these are not cached. */\r\n private getMissing(categoryIds: Id64Arg): Id64Set | undefined {\r\n let missing: Id64Set | undefined;\r\n for (const catId of Id64.iterable(categoryIds)) {\r\n if (undefined === this._byCategoryId.get(catId)) {\r\n if (undefined === missing)\r\n missing = new Set<string>();\r\n\r\n missing.add(catId);\r\n }\r\n }\r\n\r\n return missing;\r\n }\r\n\r\n public clear(): void {\r\n this._byCategoryId.clear();\r\n this._appearances.clear();\r\n }\r\n\r\n public onIModelConnectionClose(): void {\r\n this.clear();\r\n }\r\n\r\n private static createSubCategoryAppearance(json?: any) {\r\n let props: SubCategoryAppearance.Props | undefined;\r\n if (\"string\" === typeof json && 0 < json.length)\r\n props = JSON.parse(json);\r\n\r\n return new SubCategoryAppearance(props);\r\n }\r\n\r\n private processResults(result: SubCategoriesCache.Result, missing: Id64Set): void {\r\n for (const row of result)\r\n this.add(row.parentId, row.id, SubCategoriesCache.createSubCategoryAppearance(row.appearance));\r\n\r\n // Ensure that any category Ids which returned no results (e.g., non-existent category, invalid Id, etc) are still recorded so they are not repeatedly re-requested\r\n for (const id of missing)\r\n if (undefined === this._byCategoryId.get(id))\r\n this._byCategoryId.set(id, invalidCategoryIdEntry);\r\n }\r\n\r\n /** Exposed strictly for tests.\r\n * @internal\r\n */\r\n public add(categoryId: string, subCategoryId: string, appearance: SubCategoryAppearance) {\r\n let set = this._byCategoryId.get(categoryId);\r\n if (undefined === set)\r\n this._byCategoryId.set(categoryId, set = new Set<string>());\r\n\r\n set.add(subCategoryId);\r\n this._appearances.set(subCategoryId, appearance);\r\n }\r\n\r\n public async getCategoryInfo(inputCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.CategoryInfo>> {\r\n // Eliminate duplicates...\r\n const categoryIds = new Set<string>(typeof inputCategoryIds === \"string\" ? [inputCategoryIds] : inputCategoryIds);\r\n const req = this.load(categoryIds);\r\n if (req)\r\n await req.promise;\r\n\r\n const map = new Map<Id64String, IModelConnection.Categories.CategoryInfo>();\r\n for (const categoryId of categoryIds) {\r\n const subCategoryIds = this._byCategoryId.get(categoryId);\r\n if (!subCategoryIds)\r\n continue;\r\n\r\n const subCategories = this.mapSubCategoryInfos(categoryId, subCategoryIds);\r\n map.set(categoryId, { id: categoryId, subCategories });\r\n }\r\n\r\n return map;\r\n }\r\n\r\n public async getSubCategoryInfo(categoryId: Id64String, inputSubCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.SubCategoryInfo>> {\r\n // Eliminate duplicates...\r\n const subCategoryIds = new Set<string>(typeof inputSubCategoryIds === \"string\" ? [inputSubCategoryIds] : inputSubCategoryIds);\r\n const req = this.load(categoryId);\r\n if (req)\r\n await req.promise;\r\n\r\n return this.mapSubCategoryInfos(categoryId, subCategoryIds);\r\n }\r\n\r\n private mapSubCategoryInfos(categoryId: Id64String, subCategoryIds: Set<Id64String>): Map<Id64String, IModelConnection.Categories.SubCategoryInfo> {\r\n const map = new Map<Id64String, IModelConnection.Categories.SubCategoryInfo>();\r\n for (const id of subCategoryIds) {\r\n const appearance = this._appearances.get(id);\r\n if (appearance)\r\n map.set(id, { id, categoryId, appearance });\r\n }\r\n\r\n return map;\r\n }\r\n}\r\n\r\n/** This namespace and the types within it are exported strictly for use in tests.\r\n * @internal\r\n */\r\nexport namespace SubCategoriesCache { // eslint-disable-line no-redeclare\r\n export type Result = SubCategoryResultRow[];\r\n\r\n export class Request {\r\n private readonly _imodel: IModelConnection;\r\n private readonly _categoryIds: CompressedId64Set[] = [];\r\n private readonly _result: Result = [];\r\n private _canceled = false;\r\n private _curCategoryIdsIndex = 0;\r\n\r\n public get wasCanceled() { return this._canceled || this._imodel.isClosed; }\r\n\r\n public constructor(categoryIds: Set<string>, imodel: IModelConnection, maxCategoriesPerQuery = 200) {\r\n this._imodel = imodel;\r\n\r\n const catIds = [...categoryIds];\r\n OrderedId64Iterable.sortArray(catIds); // sort categories, so that given the same set of categoryIds we will always create the same batches.\r\n while (catIds.length !== 0) {\r\n const end = (catIds.length > maxCategoriesPerQuery) ? maxCategoriesPerQuery : catIds.length;\r\n const compressedIds = CompressedId64Set.compressArray(catIds.splice(0, end));\r\n this._categoryIds.push(compressedIds);\r\n }\r\n }\r\n\r\n public cancel() { this._canceled = true; }\r\n\r\n public async dispatch(): Promise<Result | undefined> {\r\n if (this.wasCanceled || this._curCategoryIdsIndex >= this._categoryIds.length) // handle case of empty category Id set...\r\n return undefined;\r\n\r\n try {\r\n const catIds = this._categoryIds[this._curCategoryIdsIndex];\r\n const result = await this._imodel.querySubCategories(catIds);\r\n this._result.push(...result);\r\n if (this.wasCanceled)\r\n return undefined;\r\n } catch {\r\n // ###TODO: detect cases in which retry is warranted\r\n // Note that currently, if we succeed in obtaining some pages of results and fail to retrieve another page, we will end up processing the\r\n // incomplete results. Since we're not retrying, that's the best we can do.\r\n }\r\n\r\n // Finished with current batch of categoryIds. Dispatch the next batch if one exists.\r\n if (++this._curCategoryIdsIndex < this._categoryIds.length) {\r\n if (this.wasCanceled)\r\n return undefined;\r\n else\r\n return this.dispatch();\r\n }\r\n\r\n // Even if we were canceled, we've retrieved all the rows. Might as well process them to prevent another request for some of the same rows from being enqueued.\r\n return this._result;\r\n }\r\n }\r\n\r\n export type QueueFunc = () => void;\r\n\r\n export class QueueEntry {\r\n public readonly categoryIds: Id64Set;\r\n public readonly funcs: QueueFunc[];\r\n\r\n public constructor(categoryIds: Id64Set, func: QueueFunc) {\r\n this.categoryIds = categoryIds;\r\n this.funcs = [func];\r\n }\r\n }\r\n\r\n /** A \"queue\" of SubCategoriesRequests, which consists of between 0 and 2 entries. Each entry specifies the set of category IDs to be loaded and a list of functions to be executed\r\n * when loading is completed. This is used to enforce ordering of operations upon subcategories despite the need to asynchronously load them. It incidentally also provides an\r\n * opportunity to reduce the number of backend requests by batching consecutive requests.\r\n * Chiefly used by [[Viewport]].\r\n * @internal\r\n */\r\n export class Queue {\r\n /* NB: Members marked protected for use in tests only. */\r\n protected _current?: QueueEntry;\r\n protected _next?: QueueEntry;\r\n protected _request?: SubCategoriesRequest;\r\n protected _disposed = false;\r\n\r\n /** Push a request onto the queue. The requested categories will be loaded if necessary, and then\r\n * the supplied function will be invoked. Any previously-pushed requests are guaranteed to be processed before this one.\r\n */\r\n public push(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n if (this._disposed)\r\n return;\r\n else if (undefined === this._current)\r\n this.pushCurrent(cache, categoryIds, func);\r\n else\r\n this.pushNext(categoryIds, func);\r\n }\r\n\r\n /** Cancel all requests and empty the queue. */\r\n public dispose(): void {\r\n if (undefined !== this._request) {\r\n assert(undefined !== this._current);\r\n this._request.cancel();\r\n this._request = undefined;\r\n }\r\n\r\n this._current = this._next = undefined;\r\n this._disposed = true;\r\n }\r\n\r\n public get isEmpty(): boolean {\r\n return undefined === this._current && undefined === this._next;\r\n }\r\n\r\n private pushCurrent(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined === this._next);\r\n assert(undefined === this._current);\r\n assert(undefined === this._request);\r\n\r\n this._request = cache.load(categoryIds);\r\n if (undefined === this._request) {\r\n // All requested categories are already loaded.\r\n func();\r\n return;\r\n } else {\r\n // We need to load the requested categories before invoking the function.\r\n this.processCurrent(cache, new QueueEntry(Id64.toIdSet(categoryIds, true), func));\r\n }\r\n }\r\n\r\n private processCurrent(cache: SubCategoriesCache, entry: QueueEntry): void {\r\n assert(undefined !== this._request);\r\n assert(undefined === this._current);\r\n assert(undefined === this._next);\r\n\r\n this._current = entry;\r\n this._request.promise.then((completed: boolean) => { // eslint-disable-line @typescript-eslint/no-floating-promises\r\n if (this._disposed)\r\n return;\r\n\r\n // Invoke all the functions which were awaiting this set of IModelConnection.Categories.\r\n assert(undefined !== this._current);\r\n if (completed)\r\n for (const func of this._current.funcs)\r\n func();\r\n\r\n this._request = undefined;\r\n this._current = undefined;\r\n\r\n // If we have more requests, process them.\r\n const next = this._next;\r\n this._next = undefined;\r\n if (undefined !== next) {\r\n this._request = cache.load(next.categoryIds);\r\n if (undefined === this._request) {\r\n // All categories loaded.\r\n for (const func of next.funcs)\r\n func();\r\n } else {\r\n // We need to load the requested categories before invoking the pending functions.\r\n this.processCurrent(cache, next);\r\n }\r\n }\r\n });\r\n }\r\n\r\n private pushNext(categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined !== this._current);\r\n assert(undefined !== this._request);\r\n\r\n if (undefined === this._next) {\r\n // We have a request currently in process and none pending.\r\n // We could potentially determine that this request doesn't require any categories that are not already loaded or being loaded by the current request.\r\n // But we will find that out (synchronously) when current request completes, unless more requests come in. Probably not worth it.\r\n this._next = new QueueEntry(Id64.toIdSet(categoryIds, true), func);\r\n } else {\r\n // We have a request currently in process, and one or more pending. Append this one to the pending.\r\n this._next.funcs.push(func);\r\n for (const categoryId of Id64.iterable(categoryIds))\r\n this._next.categoryIds.add(categoryId);\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SubCategoriesCache.js","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAyH;AACzH,oDAAiF;AAkBjF,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjD;;GAEG;AACH,MAAa,kBAAkB;IAM7B,YAAmB,MAAwB;QAL1B,kBAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;QAC3C,iBAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;QAI1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAAC,CAAC;IAEvE,wIAAwI;IACjI,gBAAgB,CAAC,UAAkB,IAAyB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/G,wHAAwH;IACjH,wBAAwB,CAAC,aAAyB,IAAuC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAEzJ;;;;OAIG;IACI,IAAI,CAAC,WAAoB;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC7C,IAAI,SAAS,KAAK,OAAO;YACvB,OAAO,SAAS,CAAC;QAEnB,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtE,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,MAAkC,EAAE,EAAE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C3D,sJAAsJ;gBACtJ,iIAAiI;gBACjI,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,mBAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACrE,CAAC;iBAAM,CAAC;gBACN,mGAAmG;gBACnG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5B,KAAK,MAAM,UAAU,IAAI,mBAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;oBACjD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;KACF;IAvGY,wBAAK,QAuGjB,CAAA;AACH,CAAC,EAjLgB,kBAAkB,kCAAlB,kBAAkB,QAiLlC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { assert, CompressedId64Set, Id64, Id64Arg, Id64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { SubCategoryAppearance, SubCategoryResultRow } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** A cancelable paginated request for subcategory information.\r\n * @see SubCategoriesCache\r\n * @internal\r\n */\r\nexport interface SubCategoriesRequest {\r\n /** The Ids of any categories which were requested but were not yet loaded. */\r\n readonly missingCategoryIds: Id64Set;\r\n /** A promise which resolves to true when all of the requested categories have been loaded, or to false if not all categories were loaded.\r\n * Categories may fail to load if the request is explicitly canceled or if the IModelConnection is closed before all categories are loaded.\r\n */\r\n readonly promise: Promise<boolean>;\r\n /** Cancels the request. */\r\n cancel(): void;\r\n}\r\n\r\nconst invalidCategoryIdEntry = new Set<string>();\r\n\r\n/** A cache of information about the subcategories contained within an [[IModelConnection]]. It is populated on demand.\r\n * @internal\r\n */\r\nexport class SubCategoriesCache {\r\n private readonly _byCategoryId = new Map<string, Id64Set>();\r\n private readonly _appearances = new Map<string, SubCategoryAppearance>();\r\n private readonly _imodel: IModelConnection;\r\n private _missingAtTimeOfPreload: Id64Set | undefined;\r\n\r\n public constructor(imodel: IModelConnection) { this._imodel = imodel; }\r\n\r\n /** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */\r\n public getSubCategories(categoryId: string): Id64Set | undefined { return this._byCategoryId.get(categoryId); }\r\n\r\n /** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */\r\n public getSubCategoryAppearance(subCategoryId: Id64String): SubCategoryAppearance | undefined { return this._appearances.get(subCategoryId.toString()); }\r\n\r\n /** Request that the subcategory information for all of the specified categories is loaded.\r\n * If all such information has already been loaded, returns undefined.\r\n * Otherwise, dispatches an asynchronous request to load those categories which are not already loaded and returns a cancellable request object\r\n * containing the corresponding promise and the set of categories still to be loaded.\r\n */\r\n public load(categoryIds: Id64Arg): SubCategoriesRequest | undefined {\r\n const missing = this.getMissing(categoryIds);\r\n if (undefined === missing)\r\n return undefined;\r\n\r\n const request = new SubCategoriesCache.Request(missing, this._imodel);\r\n const promise = request.dispatch().then((result?: SubCategoriesCache.Result) => {\r\n if (undefined !== result)\r\n this.processResults(result, missing);\r\n\r\n return !request.wasCanceled;\r\n });\r\n\r\n return {\r\n missingCategoryIds: missing,\r\n promise,\r\n cancel: () => request.cancel(),\r\n };\r\n }\r\n\r\n /** Given categoryIds, return which of these are not cached. */\r\n private getMissing(categoryIds: Id64Arg): Id64Set | undefined {\r\n let missing: Id64Set | undefined;\r\n for (const catId of Id64.iterable(categoryIds)) {\r\n if (undefined === this._byCategoryId.get(catId)) {\r\n if (undefined === missing)\r\n missing = new Set<string>();\r\n\r\n missing.add(catId);\r\n }\r\n }\r\n\r\n return missing;\r\n }\r\n\r\n public clear(): void {\r\n this._byCategoryId.clear();\r\n this._appearances.clear();\r\n }\r\n\r\n public onIModelConnectionClose(): void {\r\n this.clear();\r\n }\r\n\r\n private static createSubCategoryAppearance(json?: any) {\r\n let props: SubCategoryAppearance.Props | undefined;\r\n if (\"string\" === typeof json && 0 < json.length)\r\n props = JSON.parse(json);\r\n\r\n return new SubCategoryAppearance(props);\r\n }\r\n\r\n private processResults(result: SubCategoriesCache.Result, missing: Id64Set): void {\r\n for (const row of result)\r\n this.add(row.parentId, row.id, SubCategoriesCache.createSubCategoryAppearance(row.appearance));\r\n\r\n // Ensure that any category Ids which returned no results (e.g., non-existent category, invalid Id, etc) are still recorded so they are not repeatedly re-requested\r\n for (const id of missing)\r\n if (undefined === this._byCategoryId.get(id))\r\n this._byCategoryId.set(id, invalidCategoryIdEntry);\r\n }\r\n\r\n /** Exposed strictly for tests.\r\n * @internal\r\n */\r\n public add(categoryId: string, subCategoryId: string, appearance: SubCategoryAppearance) {\r\n let set = this._byCategoryId.get(categoryId);\r\n if (undefined === set)\r\n this._byCategoryId.set(categoryId, set = new Set<string>());\r\n\r\n set.add(subCategoryId);\r\n this._appearances.set(subCategoryId, appearance);\r\n }\r\n\r\n public async getCategoryInfo(inputCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.CategoryInfo>> {\r\n // Eliminate duplicates...\r\n const categoryIds = new Set<string>(typeof inputCategoryIds === \"string\" ? [inputCategoryIds] : inputCategoryIds);\r\n const req = this.load(categoryIds);\r\n if (req)\r\n await req.promise;\r\n\r\n const map = new Map<Id64String, IModelConnection.Categories.CategoryInfo>();\r\n for (const categoryId of categoryIds) {\r\n const subCategoryIds = this._byCategoryId.get(categoryId);\r\n if (!subCategoryIds)\r\n continue;\r\n\r\n const subCategories = this.mapSubCategoryInfos(categoryId, subCategoryIds);\r\n map.set(categoryId, { id: categoryId, subCategories });\r\n }\r\n\r\n return map;\r\n }\r\n\r\n public async getSubCategoryInfo(categoryId: Id64String, inputSubCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.SubCategoryInfo>> {\r\n // Eliminate duplicates...\r\n const subCategoryIds = new Set<string>(typeof inputSubCategoryIds === \"string\" ? [inputSubCategoryIds] : inputSubCategoryIds);\r\n const req = this.load(categoryId);\r\n if (req)\r\n await req.promise;\r\n\r\n return this.mapSubCategoryInfos(categoryId, subCategoryIds);\r\n }\r\n\r\n private mapSubCategoryInfos(categoryId: Id64String, subCategoryIds: Set<Id64String>): Map<Id64String, IModelConnection.Categories.SubCategoryInfo> {\r\n const map = new Map<Id64String, IModelConnection.Categories.SubCategoryInfo>();\r\n for (const id of subCategoryIds) {\r\n const appearance = this._appearances.get(id);\r\n if (appearance)\r\n map.set(id, { id, categoryId, appearance });\r\n }\r\n\r\n return map;\r\n }\r\n}\r\n\r\n/** This namespace and the types within it are exported strictly for use in tests.\r\n * @internal\r\n */\r\nexport namespace SubCategoriesCache { // eslint-disable-line no-redeclare\r\n export type Result = SubCategoryResultRow[];\r\n\r\n export class Request {\r\n private readonly _imodel: IModelConnection;\r\n private readonly _categoryIds: CompressedId64Set[] = [];\r\n private readonly _result: Result = [];\r\n private _canceled = false;\r\n private _curCategoryIdsIndex = 0;\r\n\r\n public get wasCanceled() { return this._canceled || this._imodel.isClosed; }\r\n\r\n public constructor(categoryIds: Set<string>, imodel: IModelConnection, maxCategoriesPerQuery = 2500) {\r\n this._imodel = imodel;\r\n\r\n const catIds = [...categoryIds];\r\n OrderedId64Iterable.sortArray(catIds); // sort categories, so that given the same set of categoryIds we will always create the same batches.\r\n while (catIds.length !== 0) {\r\n const end = (catIds.length > maxCategoriesPerQuery) ? maxCategoriesPerQuery : catIds.length;\r\n const compressedIds = CompressedId64Set.compressArray(catIds.splice(0, end));\r\n this._categoryIds.push(compressedIds);\r\n }\r\n }\r\n\r\n public cancel() { this._canceled = true; }\r\n\r\n public async dispatch(): Promise<Result | undefined> {\r\n if (this.wasCanceled || this._curCategoryIdsIndex >= this._categoryIds.length) // handle case of empty category Id set...\r\n return undefined;\r\n\r\n try {\r\n const catIds = this._categoryIds[this._curCategoryIdsIndex];\r\n const result = await this._imodel.querySubCategories(catIds);\r\n this._result.push(...result);\r\n if (this.wasCanceled)\r\n return undefined;\r\n } catch {\r\n // ###TODO: detect cases in which retry is warranted\r\n // Note that currently, if we succeed in obtaining some pages of results and fail to retrieve another page, we will end up processing the\r\n // incomplete results. Since we're not retrying, that's the best we can do.\r\n }\r\n\r\n // Finished with current batch of categoryIds. Dispatch the next batch if one exists.\r\n if (++this._curCategoryIdsIndex < this._categoryIds.length) {\r\n if (this.wasCanceled)\r\n return undefined;\r\n else\r\n return this.dispatch();\r\n }\r\n\r\n // Even if we were canceled, we've retrieved all the rows. Might as well process them to prevent another request for some of the same rows from being enqueued.\r\n return this._result;\r\n }\r\n }\r\n\r\n export type QueueFunc = () => void;\r\n\r\n export class QueueEntry {\r\n public readonly categoryIds: Id64Set;\r\n public readonly funcs: QueueFunc[];\r\n\r\n public constructor(categoryIds: Id64Set, func: QueueFunc) {\r\n this.categoryIds = categoryIds;\r\n this.funcs = [func];\r\n }\r\n }\r\n\r\n /** A \"queue\" of SubCategoriesRequests, which consists of between 0 and 2 entries. Each entry specifies the set of category IDs to be loaded and a list of functions to be executed\r\n * when loading is completed. This is used to enforce ordering of operations upon subcategories despite the need to asynchronously load them. It incidentally also provides an\r\n * opportunity to reduce the number of backend requests by batching consecutive requests.\r\n * Chiefly used by [[Viewport]].\r\n * @internal\r\n */\r\n export class Queue {\r\n /* NB: Members marked protected for use in tests only. */\r\n protected _current?: QueueEntry;\r\n protected _next?: QueueEntry;\r\n protected _request?: SubCategoriesRequest;\r\n protected _disposed = false;\r\n\r\n /** Push a request onto the queue. The requested categories will be loaded if necessary, and then\r\n * the supplied function will be invoked. Any previously-pushed requests are guaranteed to be processed before this one.\r\n */\r\n public push(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n if (this._disposed)\r\n return;\r\n else if (undefined === this._current)\r\n this.pushCurrent(cache, categoryIds, func);\r\n else\r\n this.pushNext(categoryIds, func);\r\n }\r\n\r\n /** Cancel all requests and empty the queue. */\r\n public dispose(): void {\r\n if (undefined !== this._request) {\r\n assert(undefined !== this._current);\r\n this._request.cancel();\r\n this._request = undefined;\r\n }\r\n\r\n this._current = this._next = undefined;\r\n this._disposed = true;\r\n }\r\n\r\n public get isEmpty(): boolean {\r\n return undefined === this._current && undefined === this._next;\r\n }\r\n\r\n private pushCurrent(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined === this._next);\r\n assert(undefined === this._current);\r\n assert(undefined === this._request);\r\n\r\n this._request = cache.load(categoryIds);\r\n if (undefined === this._request) {\r\n // All requested categories are already loaded.\r\n func();\r\n return;\r\n } else {\r\n // We need to load the requested categories before invoking the function.\r\n this.processCurrent(cache, new QueueEntry(Id64.toIdSet(categoryIds, true), func));\r\n }\r\n }\r\n\r\n private processCurrent(cache: SubCategoriesCache, entry: QueueEntry): void {\r\n assert(undefined !== this._request);\r\n assert(undefined === this._current);\r\n assert(undefined === this._next);\r\n\r\n this._current = entry;\r\n this._request.promise.then((completed: boolean) => { // eslint-disable-line @typescript-eslint/no-floating-promises\r\n if (this._disposed)\r\n return;\r\n\r\n // Invoke all the functions which were awaiting this set of IModelConnection.Categories.\r\n assert(undefined !== this._current);\r\n if (completed)\r\n for (const func of this._current.funcs)\r\n func();\r\n\r\n this._request = undefined;\r\n this._current = undefined;\r\n\r\n // If we have more requests, process them.\r\n const next = this._next;\r\n this._next = undefined;\r\n if (undefined !== next) {\r\n this._request = cache.load(next.categoryIds);\r\n if (undefined === this._request) {\r\n // All categories loaded.\r\n for (const func of next.funcs)\r\n func();\r\n } else {\r\n // We need to load the requested categories before invoking the pending functions.\r\n this.processCurrent(cache, next);\r\n }\r\n }\r\n });\r\n }\r\n\r\n private pushNext(categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined !== this._current);\r\n assert(undefined !== this._request);\r\n\r\n if (undefined === this._next) {\r\n // We have a request currently in process and none pending.\r\n // We could potentially determine that this request doesn't require any categories that are not already loaded or being loaded by the current request.\r\n // But we will find that out (synchronously) when current request completes, unless more requests come in. Probably not worth it.\r\n this._next = new QueueEntry(Id64.toIdSet(categoryIds, true), func);\r\n } else {\r\n // We have a request currently in process, and one or more pending. Append this one to the pending.\r\n this._next.funcs.push(func);\r\n for (const categoryId of Id64.iterable(categoryIds))\r\n this._next.categoryIds.add(categoryId);\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -105,6 +105,13 @@ export declare class CurrentInputState {
105
105
  fromButton(vp: ScreenViewport, pt: XAndY, source: InputSource, applyLocks: boolean): void;
106
106
  isStartDrag(button: BeButton): boolean;
107
107
  }
108
+ /** Supplied by EditTools.initialize to make sure the current edit command finishes before starting a new primitive tool in the event that
109
+ * the current edit tool that did not do so in it's onCleanup.
110
+ * @internal
111
+ */
112
+ export interface EditCommandHandler {
113
+ finishCommand(): Promise<string>;
114
+ }
108
115
  /** Controls the operation of [[Tool]]s, administering the current [[ViewTool]], [[PrimitiveTool]], and [[IdleTool]] and forwarding events to the appropriate tool.
109
116
  * @see [[IModelApp.toolAdmin]] to access the session's `ToolAdmin`.
110
117
  * @public
@@ -131,7 +138,10 @@ export declare class ToolAdmin {
131
138
  private _defaultToolArgs?;
132
139
  private _lastHandledMotionTime?;
133
140
  private _mouseMoveOverTimeout?;
134
- /** The name of the [[PrimitiveTool]] to use as the default tool. Defaults to "Select", referring to [[SelectionTool]].
141
+ private _editCommandHandler?;
142
+ /** The name of the [[PrimitiveTool]] to use as the default tool.
143
+ * Defaults to "Select", referring to [[SelectionTool]].
144
+ * @note An empty string signifies no default tool allowing more events to be handled by [[idleTool]].
135
145
  * @see [[startDefaultTool]] to activate the default tool.
136
146
  * @see [[defaultToolArgs]] to supply arguments when starting the tool.
137
147
  */
@@ -317,6 +327,8 @@ export declare class ToolAdmin {
317
327
  /** @internal */
318
328
  startViewTool(newTool: ViewTool): Promise<void>;
319
329
  /** @internal */
330
+ setEditCommandHandler(handler?: EditCommandHandler): void;
331
+ /** @internal */
320
332
  setPrimitiveTool(newTool?: PrimitiveTool): Promise<void>;
321
333
  /** @internal */
322
334
  startPrimitiveTool(newTool?: PrimitiveTool): Promise<void>;
@@ -349,9 +361,11 @@ export declare class ToolAdmin {
349
361
  */
350
362
  dispatchUiSyncEvent(specificSyncEventId?: string, toolId?: string): void;
351
363
  /**
352
- * Starts the default [[Tool]], if any. Generally invoked automatically when other tools exit, so shouldn't be called directly.
353
- * @note The default tool is expected to be a subclass of [[PrimitiveTool]]. A call to startDefaultTool is required to terminate
354
- * an active [[ViewTool]] or [[InputCollector]] and replace or clear the current [[PrimitiveTool]].
364
+ * Starts the default [[PrimitiveTool]], if any. Generally invoked automatically when other tools exit, so shouldn't be called directly.
365
+ * @note The default tool, when specified, must be a subclass of [[PrimitiveTool]]. A call to startDefaultTool is required to terminate
366
+ * an active [[ViewTool]] or [[InputCollector]] and replace or clear the current [[PrimitiveTool]]. The default tool can not be
367
+ * a subclass of [[ViewTool]] as view tools replace each other and aren't suspended. This means [[ViewTool.exitTool]] would
368
+ * result in the active tool being undefined instead of making the default tool active.
355
369
  * The tool's [[Tool.run]] method is invoked with arguments specified by [[defaultToolArgs]].
356
370
  * @see [[defaultToolId]] to configure the default tool.
357
371
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ToolAdmin.d.ts","sourceRoot":"","sources":["../../../src/tools/ToolAdmin.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAA0B,OAAO,EAAqC,MAAM,qBAAqB,CAAC;AACzG,OAAO,EAAY,OAAO,EAAE,OAAO,EAAuB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAU,mBAAmB,EAAa,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAIpG,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAOzC,OAAO,EAAE,eAA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AwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzG,wFAAwF;IAC3E,wBAAwB,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAItE,yHAAyH;IAClH,mBAAmB,IAAI,IAAI;IAIlC,gBAAgB;IACT,6BAA6B,CAAC,OAAO,EAAE,OAAO;IAoBrD,mEAAmE;IACtD,iBAAiB,CAAC,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC;IAO1F,gBAAgB;IACH,yBAAyB,CAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,EAAE,OAAO,EAAE,cAAc,GAAG,SAAS;IAgBzG,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAO1C,eAAe,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI;IAOnD,6EAA6E;IAC7E,IAAW,uBAAuB,IAAI,uBAAuB,CAAwC;IACrG,IAAW,uBAAuB,CAAC,YAAY,EAAE,uBAAuB,EAAiD;IAEzH,gBAAgB;IACH,aAAa;CAM3B;AAED;;;GAGG;AACH,qBAAa,mBAAmB;WACV,OAAO,CAAC,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;mBAa1D,MAAM;CA4F5B"}
@@ -318,7 +318,9 @@ class ToolAdmin {
318
318
  */
319
319
  this.manipulatorToolEvent = new core_bentley_1.BeEvent();
320
320
  }
321
- /** The name of the [[PrimitiveTool]] to use as the default tool. Defaults to "Select", referring to [[SelectionTool]].
321
+ /** The name of the [[PrimitiveTool]] to use as the default tool.
322
+ * Defaults to "Select", referring to [[SelectionTool]].
323
+ * @note An empty string signifies no default tool allowing more events to be handled by [[idleTool]].
322
324
  * @see [[startDefaultTool]] to activate the default tool.
323
325
  * @see [[defaultToolArgs]] to supply arguments when starting the tool.
324
326
  */
@@ -1284,9 +1286,15 @@ class ToolAdmin {
1284
1286
  this.onActiveToolChanged(newTool, StartOrResume.Start);
1285
1287
  }
1286
1288
  /** @internal */
1289
+ setEditCommandHandler(handler) {
1290
+ this._editCommandHandler = handler;
1291
+ }
1292
+ /** @internal */
1287
1293
  async setPrimitiveTool(newTool) {
1288
1294
  if (undefined !== this._primitiveTool) {
1289
1295
  await this._primitiveTool.onCleanup();
1296
+ if (undefined !== this._editCommandHandler)
1297
+ await this._editCommandHandler.finishCommand();
1290
1298
  this._primitiveTool = undefined;
1291
1299
  }
1292
1300
  this._primitiveTool = newTool;
@@ -1370,15 +1378,25 @@ class ToolAdmin {
1370
1378
  }
1371
1379
  }
1372
1380
  /**
1373
- * Starts the default [[Tool]], if any. Generally invoked automatically when other tools exit, so shouldn't be called directly.
1374
- * @note The default tool is expected to be a subclass of [[PrimitiveTool]]. A call to startDefaultTool is required to terminate
1375
- * an active [[ViewTool]] or [[InputCollector]] and replace or clear the current [[PrimitiveTool]].
1381
+ * Starts the default [[PrimitiveTool]], if any. Generally invoked automatically when other tools exit, so shouldn't be called directly.
1382
+ * @note The default tool, when specified, must be a subclass of [[PrimitiveTool]]. A call to startDefaultTool is required to terminate
1383
+ * an active [[ViewTool]] or [[InputCollector]] and replace or clear the current [[PrimitiveTool]]. The default tool can not be
1384
+ * a subclass of [[ViewTool]] as view tools replace each other and aren't suspended. This means [[ViewTool.exitTool]] would
1385
+ * result in the active tool being undefined instead of making the default tool active.
1376
1386
  * The tool's [[Tool.run]] method is invoked with arguments specified by [[defaultToolArgs]].
1377
1387
  * @see [[defaultToolId]] to configure the default tool.
1378
1388
  */
1379
1389
  async startDefaultTool() {
1380
- if (!await IModelApp_1.IModelApp.tools.run(this.defaultToolId, this.defaultToolArgs))
1381
- return this.startPrimitiveTool(undefined);
1390
+ const tool = IModelApp_1.IModelApp.tools.create(this.defaultToolId, this.defaultToolArgs);
1391
+ if (tool instanceof PrimitiveTool_1.PrimitiveTool) {
1392
+ if (!await tool.run(this.defaultToolArgs))
1393
+ return this.startPrimitiveTool(undefined);
1394
+ }
1395
+ else {
1396
+ await this.startPrimitiveTool(undefined); // Ensure active primitive tool is terminated...
1397
+ if (undefined !== tool)
1398
+ throw new Error("Default tool must be a subclass of PrimitiveTool");
1399
+ }
1382
1400
  }
1383
1401
  /**
1384
1402
  * Call from external events or immediate tools that may have invalidated the current primitive tool's state.