@itwin/core-frontend 5.9.0-dev.8 → 5.10.0-dev.1
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 +16 -1
- package/lib/cjs/BriefcaseTxns.d.ts +58 -1
- package/lib/cjs/BriefcaseTxns.d.ts.map +1 -1
- package/lib/cjs/BriefcaseTxns.js +65 -0
- package/lib/cjs/BriefcaseTxns.js.map +1 -1
- package/lib/cjs/PerModelCategoryVisibility.d.ts.map +1 -1
- package/lib/cjs/PerModelCategoryVisibility.js +83 -81
- package/lib/cjs/PerModelCategoryVisibility.js.map +1 -1
- package/lib/cjs/SpatialViewState.d.ts.map +1 -1
- package/lib/cjs/SpatialViewState.js +3 -1
- package/lib/cjs/SpatialViewState.js.map +1 -1
- package/lib/cjs/ViewState.d.ts +32 -0
- package/lib/cjs/ViewState.d.ts.map +1 -1
- package/lib/cjs/ViewState.js +41 -4
- package/lib/cjs/ViewState.js.map +1 -1
- package/lib/cjs/internal/render/webgl/FrustumUniforms.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/FrustumUniforms.js.map +1 -1
- package/lib/cjs/internal/render/webgl/RenderCommands.js.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts +119 -22
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.js +261 -59
- package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/cjs/tools/ToolAdmin.d.ts +20 -1
- package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/cjs/tools/ToolAdmin.js +75 -7
- package/lib/cjs/tools/ToolAdmin.js.map +1 -1
- package/lib/cjs/tools/ToolSettings.d.ts +4 -0
- package/lib/cjs/tools/ToolSettings.d.ts.map +1 -1
- package/lib/cjs/tools/ToolSettings.js +4 -0
- package/lib/cjs/tools/ToolSettings.js.map +1 -1
- package/lib/esm/BriefcaseTxns.d.ts +58 -1
- package/lib/esm/BriefcaseTxns.d.ts.map +1 -1
- package/lib/esm/BriefcaseTxns.js +65 -0
- package/lib/esm/BriefcaseTxns.js.map +1 -1
- package/lib/esm/PerModelCategoryVisibility.d.ts.map +1 -1
- package/lib/esm/PerModelCategoryVisibility.js +84 -82
- package/lib/esm/PerModelCategoryVisibility.js.map +1 -1
- package/lib/esm/SpatialViewState.d.ts.map +1 -1
- package/lib/esm/SpatialViewState.js +3 -1
- package/lib/esm/SpatialViewState.js.map +1 -1
- package/lib/esm/ViewState.d.ts +32 -0
- package/lib/esm/ViewState.d.ts.map +1 -1
- package/lib/esm/ViewState.js +42 -5
- package/lib/esm/ViewState.js.map +1 -1
- package/lib/esm/internal/render/webgl/FrustumUniforms.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/FrustumUniforms.js.map +1 -1
- package/lib/esm/internal/render/webgl/RenderCommands.js.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts +119 -22
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.js +263 -61
- package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/esm/tools/ToolAdmin.d.ts +20 -1
- package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/esm/tools/ToolAdmin.js +77 -9
- package/lib/esm/tools/ToolAdmin.js.map +1 -1
- package/lib/esm/tools/ToolSettings.d.ts +4 -0
- package/lib/esm/tools/ToolSettings.d.ts.map +1 -1
- package/lib/esm/tools/ToolSettings.js +4 -0
- package/lib/esm/tools/ToolSettings.js.map +1 -1
- package/lib/public/locales/en/iModelJs.json +1 -0
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# Change Log - @itwin/core-frontend
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 23 Apr 2026 18:06:53 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.8.4
|
|
6
|
+
Thu, 23 Apr 2026 18:05:14 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 5.8.3
|
|
11
|
+
Thu, 23 Apr 2026 14:52:42 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 5.8.2
|
|
16
|
+
Thu, 16 Apr 2026 11:05:01 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
4
19
|
|
|
5
20
|
## 5.8.1
|
|
6
21
|
Fri, 10 Apr 2026 13:02:00 GMT
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module IModelConnection
|
|
3
3
|
*/
|
|
4
4
|
import { BeEvent, IModelStatus } from "@itwin/core-bentley";
|
|
5
|
-
import { ChangesetIdWithIndex, ChangesetIndexAndId, ChangesetProps, EcefLocationProps, GeographicCRSProps, ModelIdAndGeometryGuid, NotifyEntitiesChangedArgs, RootSubjectProps, TxnNotifications, TxnProps } from "@itwin/core-common";
|
|
5
|
+
import { ChangesetIdWithIndex, ChangesetIndexAndId, ChangesetProps, EcefLocationProps, GeographicCRSProps, ModelIdAndGeometryGuid, NotifyEntitiesChangedArgs, ReinstateTxnArgs, ReverseTxnArgs, RootSubjectProps, TxnNotifications, TxnProps } from "@itwin/core-common";
|
|
6
6
|
import { Range3dProps, XYZProps } from "@itwin/core-geometry";
|
|
7
7
|
import { BriefcaseConnection } from "./BriefcaseConnection";
|
|
8
8
|
import { NotificationHandler } from "./IpcApp";
|
|
@@ -161,6 +161,21 @@ export declare class BriefcaseTxns extends BriefcaseNotificationHandler implemen
|
|
|
161
161
|
* @see [[isUndoPossible]] to determine if any reversible operations exist.
|
|
162
162
|
*/
|
|
163
163
|
reverseSingleTxn(): Promise<IModelStatus>;
|
|
164
|
+
/** Reverse (undo) the most recent operation to this briefcase in the current session. By default, this method also
|
|
165
|
+
* abandons the locks that were acquired for that operation.
|
|
166
|
+
* @beta
|
|
167
|
+
* @note This method will also abandon locks associated with any later, reversed Txns, if they have not
|
|
168
|
+
* already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
|
|
169
|
+
* its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
|
|
170
|
+
* with _both_ Txn 1 and Txn 2.
|
|
171
|
+
* @note If there are any outstanding uncommitted changes, they are reversed.
|
|
172
|
+
* @note The term "operation" is used rather than Txn, since multiple Txns can be grouped together via [TxnManager.beginMultiTxnOperation]($backend). So,
|
|
173
|
+
* even though this method reverses only one operation, multiple Txns may be reversed if they were grouped together when they were made.
|
|
174
|
+
* @note If there are no reversible operations, this method does nothing and returns Success.
|
|
175
|
+
* @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.
|
|
176
|
+
* @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.
|
|
177
|
+
*/
|
|
178
|
+
reverseSingleTxnAsync(args?: ReverseTxnArgs): Promise<void>;
|
|
164
179
|
/** Reverse (undo) the most recent operation(s) to the briefcase in the current session.
|
|
165
180
|
* @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will
|
|
166
181
|
* be reinstated together when/if [[reinstateTxn]] is called.
|
|
@@ -170,12 +185,43 @@ export declare class BriefcaseTxns extends BriefcaseNotificationHandler implemen
|
|
|
170
185
|
* @note If numOperations is too large only the number of reversible operations are reversed.
|
|
171
186
|
*/
|
|
172
187
|
reverseTxns(numOperations: number): Promise<IModelStatus>;
|
|
188
|
+
/** Reverse (undo) the most recent operation(s) to the briefcase in the current session. By default, this method also
|
|
189
|
+
* abandons the locks that were acquired for those operations.
|
|
190
|
+
* @beta
|
|
191
|
+
* @note This method will also abandon locks associated with any later, reversed Txns, if they have not
|
|
192
|
+
* already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
|
|
193
|
+
* its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
|
|
194
|
+
* with _both_ Txn 1 and Txn 2.
|
|
195
|
+
* @note If you do not want to abandon any locks, set [ReverseTxnArgs.retainLocks]($common) to true.
|
|
196
|
+
* @note If there are any outstanding uncommitted changes, they are reversed.
|
|
197
|
+
* @note The term "operation" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,
|
|
198
|
+
* even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.
|
|
199
|
+
* @note If numOperations is too large only the operations are reversible are reversed.
|
|
200
|
+
* @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will
|
|
201
|
+
* be reinstated together when/if ReinstateTxn is called.
|
|
202
|
+
* @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.
|
|
203
|
+
* @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.
|
|
204
|
+
*/
|
|
205
|
+
reverseTxnsAsync(numOperations: number, args?: ReverseTxnArgs): Promise<void>;
|
|
173
206
|
/** Reverse (undo) all changes back to the beginning of the session.
|
|
174
207
|
* @see [[reinstateTxn]] to redo changes.
|
|
175
208
|
* @see [[reverseSingleTxn]] to undo only the most recent operation.
|
|
176
209
|
* @see [[isUndoPossible]] to determine if any reversible operations exist.
|
|
177
210
|
*/
|
|
178
211
|
reverseAll(): Promise<IModelStatus>;
|
|
212
|
+
/** Reverse (undo) all operations back to the beginning of the session. By default, this method also
|
|
213
|
+
* abandons the locks that were acquired for those operations.
|
|
214
|
+
* @beta
|
|
215
|
+
* @note This method will also abandon locks associated with any later, reversed Txns, if they have not
|
|
216
|
+
* already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
|
|
217
|
+
* its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
|
|
218
|
+
* with _both_ Txn 1 and Txn 2.
|
|
219
|
+
* @note If there are any outstanding uncommitted changes, they are reversed.
|
|
220
|
+
* @note If there are no reversible operations, this method does nothing and returns Success.
|
|
221
|
+
* @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.
|
|
222
|
+
* @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.
|
|
223
|
+
*/
|
|
224
|
+
reverseAllTxnsAsync(args?: ReverseTxnArgs): Promise<void>;
|
|
179
225
|
/** Reinstate (redo) the most recently reversed transaction. Since at any time multiple transactions can be reversed, it
|
|
180
226
|
* may take multiple calls to this method to reinstate all reversed operations.
|
|
181
227
|
* @returns Success if a reversed transaction was reinstated, error status otherwise.
|
|
@@ -184,6 +230,17 @@ export declare class BriefcaseTxns extends BriefcaseNotificationHandler implemen
|
|
|
184
230
|
* @see [[reverseSingleTxn]] or [[reverseAll]] to undo changes.
|
|
185
231
|
*/
|
|
186
232
|
reinstateTxn(): Promise<IModelStatus>;
|
|
233
|
+
/** Reinstate (redo) the most recently reversed transaction. Since at any time multiple transactions can be reversed, it
|
|
234
|
+
* may take multiple calls to this method to reinstate all reversed operations. This method also
|
|
235
|
+
* re-acquires the locks that were abandoned when those operations were reversed.
|
|
236
|
+
* @beta
|
|
237
|
+
* @param args Optional arguments to control the behavior of the reinstate operation.
|
|
238
|
+
* @returns Success if a reversed transaction was reinstated, error status otherwise.
|
|
239
|
+
* @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.
|
|
240
|
+
* @see [[isRedoPossible]] to determine if any reinstatable operations exist.
|
|
241
|
+
* @see [[reverseSingleTxn]] or [[reverseAll]] to undo changes.
|
|
242
|
+
*/
|
|
243
|
+
reinstateTxnAsync(args?: ReinstateTxnArgs): Promise<void>;
|
|
187
244
|
/** Restart the current TxnManager session. This causes all Txns in the current session to no longer be undoable (as if the file was closed
|
|
188
245
|
* and reopened.)
|
|
189
246
|
* @note This can be quite disconcerting to the user expecting to be able to undo previously made changes. It should only be used
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BriefcaseTxns.d.ts","sourceRoot":"","sources":["../../src/BriefcaseTxns.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EAAE,cAAc,EAAgB,iBAAiB,EAAiB,kBAAkB,EACvG,sBAAsB,EAAE,yBAAyB,EAAkB,gBAAgB,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"BriefcaseTxns.d.ts","sourceRoot":"","sources":["../../src/BriefcaseTxns.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EAAE,cAAc,EAAgB,iBAAiB,EAAiB,kBAAkB,EACvG,sBAAsB,EAAE,yBAAyB,EAAE,gBAAgB,EAAkB,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EACvI,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAU,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAiB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAErE;;;;GAIG;AACH,8BAAsB,4BAA6B,SAAQ,mBAAmB;IAChE,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,MAAM;IAChC,aAAoB,oBAAoB,IAAI,MAAM,CAAC;IACnD,IAAW,WAAW,WAA0D;CACjF;AAED;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,4BAA6B,YAAW,gBA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BAAgB;IACT,yBAAyB,CAAC,IAAI,EAAE,iBAAiB,GAAG,SAAS;IAIpE,gBAAgB;IACT,uCAAuC,CAAC,GAAG,EAAE,kBAAkB,GAAG,SAAS;IAIlF,gBAAgB;IACT,oBAAoB,CAAC,SAAS,EAAE,oBAAoB;IAG3D,gBAAgB;IACT,kBAAkB,CAAC,SAAS,EAAE,oBAAoB;IAGzD,gBAAgB;IACT,+BAA+B,CAAC,OAAO,EAAE,cAAc,EAAE;IAGhE,gBAAgB;IACT,6BAA6B,CAAC,OAAO,EAAE,cAAc,EAAE;IAG9D,gBAAgB;IACT,8BAA8B;IAGrC,gBAAgB;IACT,4BAA4B,CAAC,IAAI,EAAE,QAAQ,EAAE;IAGpD,gBAAgB;IACT,6BAA6B;IAGpC,gBAAgB;IACT,2BAA2B;IAGlC,gBAAgB;IACT,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE;IAGzC,gBAAgB;IACT,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE;IAGvC,gBAAgB;IACT,oBAAoB,CAAC,GAAG,EAAE,QAAQ;IAGzC,gBAAgB;IACT,kBAAkB,CAAC,GAAG,EAAE,QAAQ;CAGxC"}
|
package/lib/cjs/BriefcaseTxns.js
CHANGED
|
@@ -215,6 +215,23 @@ class BriefcaseTxns extends BriefcaseNotificationHandler {
|
|
|
215
215
|
async reverseSingleTxn() {
|
|
216
216
|
return this.reverseTxns(1);
|
|
217
217
|
}
|
|
218
|
+
/** Reverse (undo) the most recent operation to this briefcase in the current session. By default, this method also
|
|
219
|
+
* abandons the locks that were acquired for that operation.
|
|
220
|
+
* @beta
|
|
221
|
+
* @note This method will also abandon locks associated with any later, reversed Txns, if they have not
|
|
222
|
+
* already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
|
|
223
|
+
* its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
|
|
224
|
+
* with _both_ Txn 1 and Txn 2.
|
|
225
|
+
* @note If there are any outstanding uncommitted changes, they are reversed.
|
|
226
|
+
* @note The term "operation" is used rather than Txn, since multiple Txns can be grouped together via [TxnManager.beginMultiTxnOperation]($backend). So,
|
|
227
|
+
* even though this method reverses only one operation, multiple Txns may be reversed if they were grouped together when they were made.
|
|
228
|
+
* @note If there are no reversible operations, this method does nothing and returns Success.
|
|
229
|
+
* @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.
|
|
230
|
+
* @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.
|
|
231
|
+
*/
|
|
232
|
+
async reverseSingleTxnAsync(args) {
|
|
233
|
+
await this.reverseTxnsAsync(1, args);
|
|
234
|
+
}
|
|
218
235
|
/** Reverse (undo) the most recent operation(s) to the briefcase in the current session.
|
|
219
236
|
* @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will
|
|
220
237
|
* be reinstated together when/if [[reinstateTxn]] is called.
|
|
@@ -226,6 +243,26 @@ class BriefcaseTxns extends BriefcaseNotificationHandler {
|
|
|
226
243
|
async reverseTxns(numOperations) {
|
|
227
244
|
return IpcApp_1.IpcApp.appFunctionIpc.reverseTxns(this._iModel.key, numOperations);
|
|
228
245
|
}
|
|
246
|
+
/** Reverse (undo) the most recent operation(s) to the briefcase in the current session. By default, this method also
|
|
247
|
+
* abandons the locks that were acquired for those operations.
|
|
248
|
+
* @beta
|
|
249
|
+
* @note This method will also abandon locks associated with any later, reversed Txns, if they have not
|
|
250
|
+
* already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
|
|
251
|
+
* its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
|
|
252
|
+
* with _both_ Txn 1 and Txn 2.
|
|
253
|
+
* @note If you do not want to abandon any locks, set [ReverseTxnArgs.retainLocks]($common) to true.
|
|
254
|
+
* @note If there are any outstanding uncommitted changes, they are reversed.
|
|
255
|
+
* @note The term "operation" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,
|
|
256
|
+
* even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.
|
|
257
|
+
* @note If numOperations is too large only the operations are reversible are reversed.
|
|
258
|
+
* @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will
|
|
259
|
+
* be reinstated together when/if ReinstateTxn is called.
|
|
260
|
+
* @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.
|
|
261
|
+
* @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.
|
|
262
|
+
*/
|
|
263
|
+
async reverseTxnsAsync(numOperations, args) {
|
|
264
|
+
return IpcApp_1.IpcApp.appFunctionIpc.reverseTxnsAsync(this._iModel.key, numOperations, args);
|
|
265
|
+
}
|
|
229
266
|
/** Reverse (undo) all changes back to the beginning of the session.
|
|
230
267
|
* @see [[reinstateTxn]] to redo changes.
|
|
231
268
|
* @see [[reverseSingleTxn]] to undo only the most recent operation.
|
|
@@ -234,6 +271,21 @@ class BriefcaseTxns extends BriefcaseNotificationHandler {
|
|
|
234
271
|
async reverseAll() {
|
|
235
272
|
return IpcApp_1.IpcApp.appFunctionIpc.reverseAllTxn(this._iModel.key);
|
|
236
273
|
}
|
|
274
|
+
/** Reverse (undo) all operations back to the beginning of the session. By default, this method also
|
|
275
|
+
* abandons the locks that were acquired for those operations.
|
|
276
|
+
* @beta
|
|
277
|
+
* @note This method will also abandon locks associated with any later, reversed Txns, if they have not
|
|
278
|
+
* already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning
|
|
279
|
+
* its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated
|
|
280
|
+
* with _both_ Txn 1 and Txn 2.
|
|
281
|
+
* @note If there are any outstanding uncommitted changes, they are reversed.
|
|
282
|
+
* @note If there are no reversible operations, this method does nothing and returns Success.
|
|
283
|
+
* @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.
|
|
284
|
+
* @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.
|
|
285
|
+
*/
|
|
286
|
+
async reverseAllTxnsAsync(args) {
|
|
287
|
+
return IpcApp_1.IpcApp.appFunctionIpc.reverseAllTxnsAsync(this._iModel.key, args);
|
|
288
|
+
}
|
|
237
289
|
/** Reinstate (redo) the most recently reversed transaction. Since at any time multiple transactions can be reversed, it
|
|
238
290
|
* may take multiple calls to this method to reinstate all reversed operations.
|
|
239
291
|
* @returns Success if a reversed transaction was reinstated, error status otherwise.
|
|
@@ -244,6 +296,19 @@ class BriefcaseTxns extends BriefcaseNotificationHandler {
|
|
|
244
296
|
async reinstateTxn() {
|
|
245
297
|
return IpcApp_1.IpcApp.appFunctionIpc.reinstateTxn(this._iModel.key);
|
|
246
298
|
}
|
|
299
|
+
/** Reinstate (redo) the most recently reversed transaction. Since at any time multiple transactions can be reversed, it
|
|
300
|
+
* may take multiple calls to this method to reinstate all reversed operations. This method also
|
|
301
|
+
* re-acquires the locks that were abandoned when those operations were reversed.
|
|
302
|
+
* @beta
|
|
303
|
+
* @param args Optional arguments to control the behavior of the reinstate operation.
|
|
304
|
+
* @returns Success if a reversed transaction was reinstated, error status otherwise.
|
|
305
|
+
* @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.
|
|
306
|
+
* @see [[isRedoPossible]] to determine if any reinstatable operations exist.
|
|
307
|
+
* @see [[reverseSingleTxn]] or [[reverseAll]] to undo changes.
|
|
308
|
+
*/
|
|
309
|
+
async reinstateTxnAsync(args) {
|
|
310
|
+
return IpcApp_1.IpcApp.appFunctionIpc.reinstateTxnAsync(this._iModel.key, args);
|
|
311
|
+
}
|
|
247
312
|
/** Restart the current TxnManager session. This causes all Txns in the current session to no longer be undoable (as if the file was closed
|
|
248
313
|
* and reopened.)
|
|
249
314
|
* @note This can be quite disconcerting to the user expecting to be able to undo previously made changes. It should only be used
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BriefcaseTxns.js","sourceRoot":"","sources":["../../src/BriefcaseTxns.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,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,CAAC,OAAyB;QAC5D,IAAI,CAAC,yBAAyB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;IACD,gBAAgB;IACT,8BAA8B;QACnC,IAAI,CAAC,0BAA0B,CAAC,UAAU,EAAE,CAAC;IAC/C,CAAC;IACD,gBAAgB;IACT,4BAA4B,CAAC,IAAgB;QAClD,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IACD,gBAAgB;IACT,6BAA6B;QAClC,IAAI,CAAC,yBAAyB,CAAC,UAAU,EAAE,CAAC;IAC9C,CAAC;IACD,gBAAgB;IACT,2BAA2B;QAChC,IAAI,CAAC,uBAAuB,CAAC,UAAU,EAAE,CAAC;IAC5C,CAAC;IACD,gBAAgB;IACT,iBAAiB,CAAC,IAAgB;QACvC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,gBAAgB;IACT,eAAe,CAAC,IAAgB;QACrC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,gBAAgB;IACT,oBAAoB,CAAC,GAAa;QACvC,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IACD,gBAAgB;IACT,kBAAkB,CAAC,GAAa;QACrC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACF;AA9YD,sCA8YC","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 { BeEvent, IModelStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n ChangesetIdWithIndex,\r\n ChangesetIndexAndId, ChangesetProps, EcefLocation, EcefLocationProps, GeographicCRS, GeographicCRSProps, ipcAppChannels,\r\n ModelIdAndGeometryGuid, NotifyEntitiesChangedArgs, RemoveFunction, RootSubjectProps, TxnNotifications,\r\n TxnProps,\r\n} from \"@itwin/core-common\";\r\nimport { Point3d, Range3d, Range3dProps, XYZProps } from \"@itwin/core-geometry\";\r\nimport { BriefcaseConnection } from \"./BriefcaseConnection\";\r\nimport { IpcApp, NotificationHandler } from \"./IpcApp\";\r\nimport { EntityChanges, TxnEntityChanges } from \"./TxnEntityChanges\";\r\n\r\n/**\r\n * Base class for notification handlers for events from the backend that are specific to a [[BriefcaseConnection]].\r\n * @see [[BriefcaseTxns]].\r\n * @public\r\n */\r\nexport abstract class BriefcaseNotificationHandler extends NotificationHandler {\r\n constructor(private _key: string) { super(); }\r\n public abstract get briefcaseChannelName(): string;\r\n public get channelName() { return `${this.briefcaseChannelName}/${this._key}`; }\r\n}\r\n\r\n/** Manages local changes to a [[BriefcaseConnection]] via [Txns]($docs/learning/InteractiveEditing.md).\r\n * @see [[BriefcaseConnection.txns]].\r\n * @see [TxnManager]($backend) for the backend counterpart.\r\n * @public\r\n */\r\nexport class BriefcaseTxns extends BriefcaseNotificationHandler implements TxnNotifications {\r\n private readonly _iModel: BriefcaseConnection;\r\n private _cleanup?: RemoveFunction;\r\n\r\n /** @internal */\r\n public get briefcaseChannelName() {\r\n return ipcAppChannels.txns;\r\n }\r\n\r\n /** Event raised after Txn validation or changeset application to indicate the set of changed elements.\r\n * @note If there are many changed elements in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\r\n */\r\n public readonly onElementsChanged = new BeEvent<(changes: TxnEntityChanges) => void>();\r\n\r\n /** Event raised after Txn validation or changeset application to indicate the set of changed models.\r\n * @note If there are many changed models in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\r\n */\r\n public readonly onModelsChanged = new BeEvent<(changes: TxnEntityChanges) => void>();\r\n\r\n /** Event raised after the geometry within one or more [[GeometricModelState]]s is modified by applying a changeset or validation of a transaction.\r\n * A model's geometry can change as a result of:\r\n * - Insertion or deletion of a geometric element within the model; or\r\n * - Modification of an existing element's geometric properties; or\r\n * - An explicit request to flag it as changed via [IModelDb.Models.updateModel]($backend).\r\n */\r\n public readonly onModelGeometryChanged = new BeEvent<(changes: ReadonlyArray<ModelIdAndGeometryGuid>) => void>();\r\n\r\n /** Event raised before a commit operation is performed. Initiated by a call to [[BriefcaseConnection.saveChanges]], unless there are no changes to save.\r\n * @see [[onCommitted]] for the event raised after the operation.\r\n */\r\n public readonly onCommit = new BeEvent<() => void>();\r\n\r\n /** Event raised after a commit operation is performed. Initiated by a call to [[BriefcaseConnection.saveChanges]], even if there were no changes to save.\r\n * The event supplies the following information:\r\n * - `hasPendingTxns`: true if the briefcase has local changes not yet pushed to the server.\r\n * - `time`: the time at which changes were saved on the backend (obtained via `Date.now()`).\r\n * @see [[onCommit]] for the event raised before the operation.\r\n */\r\n public readonly onCommitted = new BeEvent<(hasPendingTxns: boolean, time: number) => void>();\r\n\r\n /** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.\r\n * @see [[onReplayedExternalTxns]] for the event raised after all such changes have been applied.\r\n */\r\n public readonly onReplayExternalTxns = new BeEvent<() => void>();\r\n\r\n /** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.\r\n * @see [[onReplayExternalTxns]] for the event raised before the changes are applied.\r\n */\r\n public readonly onReplayedExternalTxns = new BeEvent<() => void>();\r\n\r\n /** Event raised after a changeset has been applied to the briefcase.\r\n * Changesets may be applied as a result of [[BriefcaseConnection.pullChanges]], or by undo/redo operations.\r\n */\r\n public readonly onChangesApplied = new BeEvent<() => void>();\r\n\r\n /** Event raised before an undo/redo operation is performed.\r\n * @see [[onAfterUndoRedo]] for the event raised after the operation.\r\n */\r\n public readonly onBeforeUndoRedo = new BeEvent<(isUndo: boolean) => void>();\r\n\r\n /** Event raised after an undo/redo operation is performed.\r\n * @see [[onBeforeUndoRedo]] for the event raised before to the operation.\r\n */\r\n public readonly onAfterUndoRedo = new BeEvent<(isUndo: boolean) => void>();\r\n\r\n /** Event raised after changes are pulled and merged into the briefcase.\r\n * @see [[BriefcaseConnection.pullAndMergeChanges]].\r\n */\r\n public readonly onChangesPulled = new BeEvent<(parentChangeset: ChangesetIndexAndId) => void>();\r\n\r\n /** Event raised after the briefcase's local changes are pushed.\r\n * @see [[BriefcaseConnection.pushChanges]].\r\n */\r\n public readonly onChangesPushed = new BeEvent<(parentChangeset: ChangesetIndexAndId) => void>();\r\n\r\n /** Event raised before pull merge process begins.\r\n * @alpha\r\n */\r\n public readonly onPullMergeBegin = new BeEvent<(changeset: ChangesetIdWithIndex) => void>();\r\n\r\n /** Event raised before a rebase operation begins.\r\n * @alpha\r\n */\r\n public readonly onRebaseBegin = new BeEvent<(txns: TxnProps[]) => void>();\r\n\r\n /** Event raised before a transaction is rebased.\r\n * @alpha\r\n */\r\n public readonly onRebaseTxnBegin = new BeEvent<(txnProps: TxnProps) => void>();\r\n\r\n /**\r\n * Event raised after a transaction is rebased.\r\n * @alpha\r\n */\r\n public readonly onRebaseTxnEnd = new BeEvent<(txnProps: TxnProps) => void>();\r\n\r\n /**\r\n * Event raised after a rebase operation ends.\r\n * @alpha\r\n */\r\n public readonly onRebaseEnd = new BeEvent<(txns: TxnProps[]) => void>();\r\n\r\n /**\r\n * Event raised after the pull merge process ends.\r\n * @alpha\r\n */\r\n public readonly onPullMergeEnd = new BeEvent<(changeset: ChangesetIdWithIndex) => void>();\r\n\r\n /** Event raised before incoming changes are applied.\r\n * @alpha\r\n */\r\n public readonly onApplyIncomingChangesBegin = new BeEvent<(changesets: ChangesetProps[]) => void>();\r\n\r\n /** Event raised after incoming changes are applied.\r\n * @alpha\r\n */\r\n public readonly onApplyIncomingChangesEnd = new BeEvent<(changes: ChangesetProps[]) => void>();\r\n\r\n /** Event raised before local changes are reversed.\r\n * @alpha\r\n */\r\n public readonly onReverseLocalChangesBegin = new BeEvent<() => void>();\r\n\r\n /** Event raised after local changes are reversed.\r\n * @alpha\r\n */\r\n public readonly onReverseLocalChangesEnd = new BeEvent<(txns: TxnProps[]) => void>();\r\n\r\n /** Event raised before downloading changesets begins.\r\n * @alpha\r\n */\r\n public readonly onDownloadChangesetsBegin = new BeEvent<() => void>();\r\n\r\n /** Event raised after downloading changesets ends.\r\n * @alpha\r\n */\r\n public readonly onDownloadChangesetsEnd = new BeEvent<() => void>();\r\n\r\n /** @internal */\r\n public constructor(iModel: BriefcaseConnection) {\r\n super(iModel.key);\r\n this._iModel = iModel;\r\n this._cleanup = this.registerImpl();\r\n }\r\n\r\n /** @internal */\r\n public [Symbol.dispose](): void {\r\n if (this._cleanup) {\r\n this._cleanup();\r\n this._cleanup = undefined;\r\n\r\n this.onAfterUndoRedo.clear();\r\n this.onApplyIncomingChangesBegin.clear();\r\n this.onApplyIncomingChangesEnd.clear();\r\n this.onBeforeUndoRedo.clear();\r\n this.onChangesApplied.clear();\r\n this.onChangesPulled.clear();\r\n this.onChangesPushed.clear();\r\n this.onCommit.clear();\r\n this.onCommitted.clear();\r\n this.onDownloadChangesetsBegin.clear();\r\n this.onDownloadChangesetsEnd.clear();\r\n this.onElementsChanged.clear();\r\n this.onModelGeometryChanged.clear();\r\n this.onModelsChanged.clear();\r\n this.onPullMergeBegin.clear();\r\n this.onPullMergeEnd.clear();\r\n this.onRebaseBegin.clear();\r\n this.onRebaseEnd.clear();\r\n this.onRebaseTxnBegin.clear();\r\n this.onRebaseTxnEnd.clear();\r\n this.onReverseLocalChangesBegin.clear();\r\n this.onReverseLocalChangesEnd.clear();\r\n }\r\n }\r\n\r\n /** Query if the briefcase has any pending Txns waiting to be pushed. */\r\n public async hasPendingTxns(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\r\n return IpcApp.appFunctionIpc.hasPendingTxns(this._iModel.key);\r\n }\r\n\r\n /** Determine if any reversible (undoable) changes exist.\r\n * @see [[reverseSingleTxn]] or [[reverseAll]] to undo changes.\r\n */\r\n public async isUndoPossible(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\r\n return IpcApp.appFunctionIpc.isUndoPossible(this._iModel.key);\r\n }\r\n\r\n /** Determine if any reinstatable (redoable) changes exist.\r\n * @see [[reinstateTxn]] to redo changes.\r\n */\r\n public async isRedoPossible(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\r\n return IpcApp.appFunctionIpc.isRedoPossible(this._iModel.key);\r\n }\r\n\r\n /** Get the description of the operation that would be reversed by calling [[reverseTxns]]`(1)`.\r\n * This is useful for showing the operation that would be undone, for example in a menu.\r\n */\r\n public async getUndoString(): Promise<string> {\r\n return IpcApp.appFunctionIpc.getUndoString(this._iModel.key);\r\n }\r\n\r\n /** Get a description of the operation that would be reinstated by calling [[reinstateTxn]].\r\n * This is useful for showing the operation that would be redone, in a pull-down menu for example.\r\n */\r\n public async getRedoString(): Promise<string> {\r\n return IpcApp.appFunctionIpc.getRedoString(this._iModel.key);\r\n }\r\n\r\n /** Reverse (undo) the most recent operation.\r\n * @see [[reinstateTxn]] to redo operations.\r\n * @see [[reverseAll]] to undo all operations.\r\n * @see [[isUndoPossible]] to determine if any reversible operations exist.\r\n */\r\n public async reverseSingleTxn(): Promise<IModelStatus> {\r\n return this.reverseTxns(1);\r\n }\r\n\r\n /** Reverse (undo) the most recent operation(s) to the briefcase in the current session.\r\n * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will\r\n * be reinstated together when/if [[reinstateTxn]] is called.\r\n * @note If there are any outstanding uncommitted changes, they are reversed.\r\n * @note The term \"operation\" is used rather than Txn, since multiple Txns can be grouped together via [TxnManager.beginMultiTxnOperation]($backend). So,\r\n * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.\r\n * @note If numOperations is too large only the number of reversible operations are reversed.\r\n */\r\n public async reverseTxns(numOperations: number): Promise<IModelStatus> {\r\n return IpcApp.appFunctionIpc.reverseTxns(this._iModel.key, numOperations);\r\n }\r\n\r\n /** Reverse (undo) all changes back to the beginning of the session.\r\n * @see [[reinstateTxn]] to redo changes.\r\n * @see [[reverseSingleTxn]] to undo only the most recent operation.\r\n * @see [[isUndoPossible]] to determine if any reversible operations exist.\r\n */\r\n public async reverseAll(): Promise<IModelStatus> {\r\n return IpcApp.appFunctionIpc.reverseAllTxn(this._iModel.key);\r\n }\r\n\r\n /** Reinstate (redo) the most recently reversed transaction. Since at any time multiple transactions can be reversed, it\r\n * may take multiple calls to this method to reinstate all reversed operations.\r\n * @returns Success if a reversed transaction was reinstated, error status otherwise.\r\n * @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.\r\n * @see [[isRedoPossible]] to determine if any reinstatable operations exist.\r\n * @see [[reverseSingleTxn]] or [[reverseAll]] to undo changes.\r\n */\r\n public async reinstateTxn(): Promise<IModelStatus> {\r\n return IpcApp.appFunctionIpc.reinstateTxn(this._iModel.key);\r\n }\r\n\r\n /** Restart the current TxnManager session. This causes all Txns in the current session to no longer be undoable (as if the file was closed\r\n * and reopened.)\r\n * @note This can be quite disconcerting to the user expecting to be able to undo previously made changes. It should only be used\r\n * under extreme circumstances where damage to the file or session could happen if the currently committed are reversed. Use sparingly and with care.\r\n * Probably a good idea to alert the user it happened.\r\n */\r\n public async restartTxnSession(): Promise<void> {\r\n await IpcApp.appFunctionIpc.restartTxnSession(this._iModel.key);\r\n }\r\n\r\n /** @internal */\r\n public notifyElementsChanged(changed: NotifyEntitiesChangedArgs): void {\r\n this.onElementsChanged.raiseEvent(new EntityChanges(changed));\r\n }\r\n\r\n /** @internal */\r\n public notifyModelsChanged(changed: NotifyEntitiesChangedArgs): void {\r\n this.onModelsChanged.raiseEvent(new EntityChanges(changed));\r\n }\r\n\r\n /** @internal */\r\n public notifyGeometryGuidsChanged(changes: ModelIdAndGeometryGuid[]): void {\r\n this.onModelGeometryChanged.raiseEvent(changes);\r\n }\r\n\r\n /** @internal */\r\n public notifyCommit() {\r\n this.onCommit.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public notifyCommitted(hasPendingTxns: boolean, time: number) {\r\n this.onCommitted.raiseEvent(hasPendingTxns, time);\r\n }\r\n\r\n /** @internal */\r\n public notifyReplayExternalTxns() {\r\n this.onReplayExternalTxns.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public notifyReplayedExternalTxns() {\r\n this.onReplayedExternalTxns.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public notifyChangesApplied() {\r\n this.onChangesApplied.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public notifyBeforeUndoRedo(isUndo: boolean) {\r\n this.onBeforeUndoRedo.raiseEvent(isUndo);\r\n }\r\n\r\n /** @internal */\r\n public notifyAfterUndoRedo(isUndo: boolean) {\r\n this.onAfterUndoRedo.raiseEvent(isUndo);\r\n }\r\n\r\n /** @internal */\r\n public notifyPulledChanges(parentChangeset: ChangesetIndexAndId) {\r\n this.onChangesPulled.raiseEvent(parentChangeset);\r\n }\r\n\r\n /** @internal */\r\n public notifyPushedChanges(parentChangeset: ChangesetIndexAndId) {\r\n this.onChangesPushed.raiseEvent(parentChangeset);\r\n }\r\n\r\n /** @internal */\r\n public notifyIModelNameChanged(name: string) {\r\n this._iModel.name = name;\r\n }\r\n\r\n /** @internal */\r\n public notifyRootSubjectChanged(subject: RootSubjectProps) {\r\n this._iModel.rootSubject = subject;\r\n }\r\n\r\n /** @internal */\r\n public notifyProjectExtentsChanged(range: Range3dProps) {\r\n this._iModel.projectExtents = Range3d.fromJSON(range);\r\n }\r\n\r\n /** @internal */\r\n public notifyGlobalOriginChanged(origin: XYZProps) {\r\n this._iModel.globalOrigin = Point3d.fromJSON(origin);\r\n }\r\n\r\n /** @internal */\r\n public notifyEcefLocationChanged(ecef: EcefLocationProps | undefined) {\r\n this._iModel.ecefLocation = ecef ? new EcefLocation(ecef) : undefined;\r\n }\r\n\r\n /** @internal */\r\n public notifyGeographicCoordinateSystemChanged(gcs: GeographicCRSProps | undefined) {\r\n this._iModel.geographicCoordinateSystem = gcs ? new GeographicCRS(gcs) : undefined;\r\n }\r\n\r\n /** @internal */\r\n public notifyPullMergeBegin(changeset: ChangesetIdWithIndex) {\r\n this.onPullMergeBegin.raiseEvent(changeset);\r\n }\r\n /** @internal */\r\n public notifyPullMergeEnd(changeset: ChangesetIdWithIndex) {\r\n this.onPullMergeEnd.raiseEvent(changeset);\r\n }\r\n /** @internal */\r\n public notifyApplyIncomingChangesBegin(changes: ChangesetProps[]) {\r\n this.onApplyIncomingChangesBegin.raiseEvent(changes);\r\n }\r\n /** @internal */\r\n public notifyApplyIncomingChangesEnd(changes: ChangesetProps[]) {\r\n this.onApplyIncomingChangesEnd.raiseEvent(changes);\r\n }\r\n /** @internal */\r\n public notifyReverseLocalChangesBegin() {\r\n this.onReverseLocalChangesBegin.raiseEvent();\r\n }\r\n /** @internal */\r\n public notifyReverseLocalChangesEnd(txns: TxnProps[]) {\r\n this.onReverseLocalChangesEnd.raiseEvent(txns);\r\n }\r\n /** @internal */\r\n public notifyDownloadChangesetsBegin() {\r\n this.onDownloadChangesetsBegin.raiseEvent();\r\n }\r\n /** @internal */\r\n public notifyDownloadChangesetsEnd() {\r\n this.onDownloadChangesetsEnd.raiseEvent();\r\n }\r\n /** @internal */\r\n public notifyRebaseBegin(txns: TxnProps[]) {\r\n this.onRebaseBegin.raiseEvent(txns);\r\n }\r\n /** @internal */\r\n public notifyRebaseEnd(txns: TxnProps[]) {\r\n this.onRebaseEnd.raiseEvent(txns);\r\n }\r\n /** @internal */\r\n public notifyRebaseTxnBegin(txn: TxnProps) {\r\n this.onRebaseTxnBegin.raiseEvent(txn);\r\n }\r\n /** @internal */\r\n public notifyRebaseTxnEnd(txn: TxnProps) {\r\n this.onRebaseTxnEnd.raiseEvent(txn);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"BriefcaseTxns.js","sourceRoot":"","sources":["../../src/BriefcaseTxns.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4D;AA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AAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,gBAAgB;IACT,eAAe,CAAC,IAAgB;QACrC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,gBAAgB;IACT,oBAAoB,CAAC,GAAa;QACvC,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IACD,gBAAgB;IACT,kBAAkB,CAAC,GAAa;QACrC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACF;AAndD,sCAmdC","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 { BeEvent, IModelStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n ChangesetIdWithIndex,\r\n ChangesetIndexAndId, ChangesetProps, EcefLocation, EcefLocationProps, GeographicCRS, GeographicCRSProps, ipcAppChannels,\r\n ModelIdAndGeometryGuid, NotifyEntitiesChangedArgs, ReinstateTxnArgs, RemoveFunction, ReverseTxnArgs, RootSubjectProps, TxnNotifications,\r\n TxnProps,\r\n} from \"@itwin/core-common\";\r\nimport { Point3d, Range3d, Range3dProps, XYZProps } from \"@itwin/core-geometry\";\r\nimport { BriefcaseConnection } from \"./BriefcaseConnection\";\r\nimport { IpcApp, NotificationHandler } from \"./IpcApp\";\r\nimport { EntityChanges, TxnEntityChanges } from \"./TxnEntityChanges\";\r\n\r\n/**\r\n * Base class for notification handlers for events from the backend that are specific to a [[BriefcaseConnection]].\r\n * @see [[BriefcaseTxns]].\r\n * @public\r\n */\r\nexport abstract class BriefcaseNotificationHandler extends NotificationHandler {\r\n constructor(private _key: string) { super(); }\r\n public abstract get briefcaseChannelName(): string;\r\n public get channelName() { return `${this.briefcaseChannelName}/${this._key}`; }\r\n}\r\n\r\n/** Manages local changes to a [[BriefcaseConnection]] via [Txns]($docs/learning/InteractiveEditing.md).\r\n * @see [[BriefcaseConnection.txns]].\r\n * @see [TxnManager]($backend) for the backend counterpart.\r\n * @public\r\n */\r\nexport class BriefcaseTxns extends BriefcaseNotificationHandler implements TxnNotifications {\r\n private readonly _iModel: BriefcaseConnection;\r\n private _cleanup?: RemoveFunction;\r\n\r\n /** @internal */\r\n public get briefcaseChannelName() {\r\n return ipcAppChannels.txns;\r\n }\r\n\r\n /** Event raised after Txn validation or changeset application to indicate the set of changed elements.\r\n * @note If there are many changed elements in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\r\n */\r\n public readonly onElementsChanged = new BeEvent<(changes: TxnEntityChanges) => void>();\r\n\r\n /** Event raised after Txn validation or changeset application to indicate the set of changed models.\r\n * @note If there are many changed models in a single Txn, the notifications are sent in batches so this event *may be called multiple times* per Txn.\r\n */\r\n public readonly onModelsChanged = new BeEvent<(changes: TxnEntityChanges) => void>();\r\n\r\n /** Event raised after the geometry within one or more [[GeometricModelState]]s is modified by applying a changeset or validation of a transaction.\r\n * A model's geometry can change as a result of:\r\n * - Insertion or deletion of a geometric element within the model; or\r\n * - Modification of an existing element's geometric properties; or\r\n * - An explicit request to flag it as changed via [IModelDb.Models.updateModel]($backend).\r\n */\r\n public readonly onModelGeometryChanged = new BeEvent<(changes: ReadonlyArray<ModelIdAndGeometryGuid>) => void>();\r\n\r\n /** Event raised before a commit operation is performed. Initiated by a call to [[BriefcaseConnection.saveChanges]], unless there are no changes to save.\r\n * @see [[onCommitted]] for the event raised after the operation.\r\n */\r\n public readonly onCommit = new BeEvent<() => void>();\r\n\r\n /** Event raised after a commit operation is performed. Initiated by a call to [[BriefcaseConnection.saveChanges]], even if there were no changes to save.\r\n * The event supplies the following information:\r\n * - `hasPendingTxns`: true if the briefcase has local changes not yet pushed to the server.\r\n * - `time`: the time at which changes were saved on the backend (obtained via `Date.now()`).\r\n * @see [[onCommit]] for the event raised before the operation.\r\n */\r\n public readonly onCommitted = new BeEvent<(hasPendingTxns: boolean, time: number) => void>();\r\n\r\n /** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.\r\n * @see [[onReplayedExternalTxns]] for the event raised after all such changes have been applied.\r\n */\r\n public readonly onReplayExternalTxns = new BeEvent<() => void>();\r\n\r\n /** Event raised for a read-only briefcase that was opened with the `watchForChanges` flag enabled when changes made by another connection are applied to the briefcase.\r\n * @see [[onReplayExternalTxns]] for the event raised before the changes are applied.\r\n */\r\n public readonly onReplayedExternalTxns = new BeEvent<() => void>();\r\n\r\n /** Event raised after a changeset has been applied to the briefcase.\r\n * Changesets may be applied as a result of [[BriefcaseConnection.pullChanges]], or by undo/redo operations.\r\n */\r\n public readonly onChangesApplied = new BeEvent<() => void>();\r\n\r\n /** Event raised before an undo/redo operation is performed.\r\n * @see [[onAfterUndoRedo]] for the event raised after the operation.\r\n */\r\n public readonly onBeforeUndoRedo = new BeEvent<(isUndo: boolean) => void>();\r\n\r\n /** Event raised after an undo/redo operation is performed.\r\n * @see [[onBeforeUndoRedo]] for the event raised before to the operation.\r\n */\r\n public readonly onAfterUndoRedo = new BeEvent<(isUndo: boolean) => void>();\r\n\r\n /** Event raised after changes are pulled and merged into the briefcase.\r\n * @see [[BriefcaseConnection.pullAndMergeChanges]].\r\n */\r\n public readonly onChangesPulled = new BeEvent<(parentChangeset: ChangesetIndexAndId) => void>();\r\n\r\n /** Event raised after the briefcase's local changes are pushed.\r\n * @see [[BriefcaseConnection.pushChanges]].\r\n */\r\n public readonly onChangesPushed = new BeEvent<(parentChangeset: ChangesetIndexAndId) => void>();\r\n\r\n /** Event raised before pull merge process begins.\r\n * @alpha\r\n */\r\n public readonly onPullMergeBegin = new BeEvent<(changeset: ChangesetIdWithIndex) => void>();\r\n\r\n /** Event raised before a rebase operation begins.\r\n * @alpha\r\n */\r\n public readonly onRebaseBegin = new BeEvent<(txns: TxnProps[]) => void>();\r\n\r\n /** Event raised before a transaction is rebased.\r\n * @alpha\r\n */\r\n public readonly onRebaseTxnBegin = new BeEvent<(txnProps: TxnProps) => void>();\r\n\r\n /**\r\n * Event raised after a transaction is rebased.\r\n * @alpha\r\n */\r\n public readonly onRebaseTxnEnd = new BeEvent<(txnProps: TxnProps) => void>();\r\n\r\n /**\r\n * Event raised after a rebase operation ends.\r\n * @alpha\r\n */\r\n public readonly onRebaseEnd = new BeEvent<(txns: TxnProps[]) => void>();\r\n\r\n /**\r\n * Event raised after the pull merge process ends.\r\n * @alpha\r\n */\r\n public readonly onPullMergeEnd = new BeEvent<(changeset: ChangesetIdWithIndex) => void>();\r\n\r\n /** Event raised before incoming changes are applied.\r\n * @alpha\r\n */\r\n public readonly onApplyIncomingChangesBegin = new BeEvent<(changesets: ChangesetProps[]) => void>();\r\n\r\n /** Event raised after incoming changes are applied.\r\n * @alpha\r\n */\r\n public readonly onApplyIncomingChangesEnd = new BeEvent<(changes: ChangesetProps[]) => void>();\r\n\r\n /** Event raised before local changes are reversed.\r\n * @alpha\r\n */\r\n public readonly onReverseLocalChangesBegin = new BeEvent<() => void>();\r\n\r\n /** Event raised after local changes are reversed.\r\n * @alpha\r\n */\r\n public readonly onReverseLocalChangesEnd = new BeEvent<(txns: TxnProps[]) => void>();\r\n\r\n /** Event raised before downloading changesets begins.\r\n * @alpha\r\n */\r\n public readonly onDownloadChangesetsBegin = new BeEvent<() => void>();\r\n\r\n /** Event raised after downloading changesets ends.\r\n * @alpha\r\n */\r\n public readonly onDownloadChangesetsEnd = new BeEvent<() => void>();\r\n\r\n /** @internal */\r\n public constructor(iModel: BriefcaseConnection) {\r\n super(iModel.key);\r\n this._iModel = iModel;\r\n this._cleanup = this.registerImpl();\r\n }\r\n\r\n /** @internal */\r\n public [Symbol.dispose](): void {\r\n if (this._cleanup) {\r\n this._cleanup();\r\n this._cleanup = undefined;\r\n\r\n this.onAfterUndoRedo.clear();\r\n this.onApplyIncomingChangesBegin.clear();\r\n this.onApplyIncomingChangesEnd.clear();\r\n this.onBeforeUndoRedo.clear();\r\n this.onChangesApplied.clear();\r\n this.onChangesPulled.clear();\r\n this.onChangesPushed.clear();\r\n this.onCommit.clear();\r\n this.onCommitted.clear();\r\n this.onDownloadChangesetsBegin.clear();\r\n this.onDownloadChangesetsEnd.clear();\r\n this.onElementsChanged.clear();\r\n this.onModelGeometryChanged.clear();\r\n this.onModelsChanged.clear();\r\n this.onPullMergeBegin.clear();\r\n this.onPullMergeEnd.clear();\r\n this.onRebaseBegin.clear();\r\n this.onRebaseEnd.clear();\r\n this.onRebaseTxnBegin.clear();\r\n this.onRebaseTxnEnd.clear();\r\n this.onReverseLocalChangesBegin.clear();\r\n this.onReverseLocalChangesEnd.clear();\r\n }\r\n }\r\n\r\n /** Query if the briefcase has any pending Txns waiting to be pushed. */\r\n public async hasPendingTxns(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\r\n return IpcApp.appFunctionIpc.hasPendingTxns(this._iModel.key);\r\n }\r\n\r\n /** Determine if any reversible (undoable) changes exist.\r\n * @see [[reverseSingleTxn]] or [[reverseAll]] to undo changes.\r\n */\r\n public async isUndoPossible(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\r\n return IpcApp.appFunctionIpc.isUndoPossible(this._iModel.key);\r\n }\r\n\r\n /** Determine if any reinstatable (redoable) changes exist.\r\n * @see [[reinstateTxn]] to redo changes.\r\n */\r\n public async isRedoPossible(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\r\n return IpcApp.appFunctionIpc.isRedoPossible(this._iModel.key);\r\n }\r\n\r\n /** Get the description of the operation that would be reversed by calling [[reverseTxns]]`(1)`.\r\n * This is useful for showing the operation that would be undone, for example in a menu.\r\n */\r\n public async getUndoString(): Promise<string> {\r\n return IpcApp.appFunctionIpc.getUndoString(this._iModel.key);\r\n }\r\n\r\n /** Get a description of the operation that would be reinstated by calling [[reinstateTxn]].\r\n * This is useful for showing the operation that would be redone, in a pull-down menu for example.\r\n */\r\n public async getRedoString(): Promise<string> {\r\n return IpcApp.appFunctionIpc.getRedoString(this._iModel.key);\r\n }\r\n\r\n /** Reverse (undo) the most recent operation.\r\n * @see [[reinstateTxn]] to redo operations.\r\n * @see [[reverseAll]] to undo all operations.\r\n * @see [[isUndoPossible]] to determine if any reversible operations exist.\r\n */\r\n public async reverseSingleTxn(): Promise<IModelStatus> {\r\n return this.reverseTxns(1);\r\n }\r\n\r\n /** Reverse (undo) the most recent operation to this briefcase in the current session. By default, this method also\r\n * abandons the locks that were acquired for that operation.\r\n * @beta\r\n * @note This method will also abandon locks associated with any later, reversed Txns, if they have not\r\n * already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning\r\n * its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated\r\n * with _both_ Txn 1 and Txn 2.\r\n * @note If there are any outstanding uncommitted changes, they are reversed.\r\n * @note The term \"operation\" is used rather than Txn, since multiple Txns can be grouped together via [TxnManager.beginMultiTxnOperation]($backend). So,\r\n * even though this method reverses only one operation, multiple Txns may be reversed if they were grouped together when they were made.\r\n * @note If there are no reversible operations, this method does nothing and returns Success.\r\n * @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.\r\n * @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.\r\n */\r\n public async reverseSingleTxnAsync(args?: ReverseTxnArgs): Promise<void> {\r\n await this.reverseTxnsAsync(1, args);\r\n }\r\n\r\n /** Reverse (undo) the most recent operation(s) to the briefcase in the current session.\r\n * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will\r\n * be reinstated together when/if [[reinstateTxn]] is called.\r\n * @note If there are any outstanding uncommitted changes, they are reversed.\r\n * @note The term \"operation\" is used rather than Txn, since multiple Txns can be grouped together via [TxnManager.beginMultiTxnOperation]($backend). So,\r\n * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.\r\n * @note If numOperations is too large only the number of reversible operations are reversed.\r\n */\r\n public async reverseTxns(numOperations: number): Promise<IModelStatus> {\r\n return IpcApp.appFunctionIpc.reverseTxns(this._iModel.key, numOperations);\r\n }\r\n\r\n /** Reverse (undo) the most recent operation(s) to the briefcase in the current session. By default, this method also\r\n * abandons the locks that were acquired for those operations.\r\n * @beta\r\n * @note This method will also abandon locks associated with any later, reversed Txns, if they have not\r\n * already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning\r\n * its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated\r\n * with _both_ Txn 1 and Txn 2.\r\n * @note If you do not want to abandon any locks, set [ReverseTxnArgs.retainLocks]($common) to true.\r\n * @note If there are any outstanding uncommitted changes, they are reversed.\r\n * @note The term \"operation\" is used rather than Txn, since multiple Txns can be grouped together via [[beginMultiTxnOperation]]. So,\r\n * even if numOperations is 1, multiple Txns may be reversed if they were grouped together when they were made.\r\n * @note If numOperations is too large only the operations are reversible are reversed.\r\n * @param numOperations the number of operations to reverse. If this is greater than 1, the entire set of operations will\r\n * be reinstated together when/if ReinstateTxn is called.\r\n * @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.\r\n * @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.\r\n */\r\n public async reverseTxnsAsync(numOperations: number, args?: ReverseTxnArgs): Promise<void> {\r\n return IpcApp.appFunctionIpc.reverseTxnsAsync(this._iModel.key, numOperations, args);\r\n }\r\n\r\n /** Reverse (undo) all changes back to the beginning of the session.\r\n * @see [[reinstateTxn]] to redo changes.\r\n * @see [[reverseSingleTxn]] to undo only the most recent operation.\r\n * @see [[isUndoPossible]] to determine if any reversible operations exist.\r\n */\r\n public async reverseAll(): Promise<IModelStatus> {\r\n return IpcApp.appFunctionIpc.reverseAllTxn(this._iModel.key);\r\n }\r\n\r\n /** Reverse (undo) all operations back to the beginning of the session. By default, this method also\r\n * abandons the locks that were acquired for those operations.\r\n * @beta\r\n * @note This method will also abandon locks associated with any later, reversed Txns, if they have not\r\n * already been abandoned. For example, if a call to [[reverseTxns]] reverses Txn 2 without abandoning\r\n * its locks, and then this method is called to reverse Txn 1, it will abandon the locks associated\r\n * with _both_ Txn 1 and Txn 2.\r\n * @note If there are any outstanding uncommitted changes, they are reversed.\r\n * @note If there are no reversible operations, this method does nothing and returns Success.\r\n * @param args Optional arguments to control the behavior of the reverse operation, such as whether to retain locks.\r\n * @returns A Promise that resolves to success if the transactions were reversed, or rejects with an IModelError otherwise.\r\n */\r\n public async reverseAllTxnsAsync(args?: ReverseTxnArgs): Promise<void> {\r\n return IpcApp.appFunctionIpc.reverseAllTxnsAsync(this._iModel.key, args);\r\n }\r\n\r\n /** Reinstate (redo) the most recently reversed transaction. Since at any time multiple transactions can be reversed, it\r\n * may take multiple calls to this method to reinstate all reversed operations.\r\n * @returns Success if a reversed transaction was reinstated, error status otherwise.\r\n * @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.\r\n * @see [[isRedoPossible]] to determine if any reinstatable operations exist.\r\n * @see [[reverseSingleTxn]] or [[reverseAll]] to undo changes.\r\n */\r\n public async reinstateTxn(): Promise<IModelStatus> {\r\n return IpcApp.appFunctionIpc.reinstateTxn(this._iModel.key);\r\n }\r\n\r\n /** Reinstate (redo) the most recently reversed transaction. Since at any time multiple transactions can be reversed, it\r\n * may take multiple calls to this method to reinstate all reversed operations. This method also\r\n * re-acquires the locks that were abandoned when those operations were reversed.\r\n * @beta\r\n * @param args Optional arguments to control the behavior of the reinstate operation.\r\n * @returns Success if a reversed transaction was reinstated, error status otherwise.\r\n * @note If there are any outstanding uncommitted changes, they are canceled before the Txn is reinstated.\r\n * @see [[isRedoPossible]] to determine if any reinstatable operations exist.\r\n * @see [[reverseSingleTxn]] or [[reverseAll]] to undo changes.\r\n */\r\n public async reinstateTxnAsync(args?: ReinstateTxnArgs): Promise<void> {\r\n return IpcApp.appFunctionIpc.reinstateTxnAsync(this._iModel.key, args);\r\n }\r\n\r\n /** Restart the current TxnManager session. This causes all Txns in the current session to no longer be undoable (as if the file was closed\r\n * and reopened.)\r\n * @note This can be quite disconcerting to the user expecting to be able to undo previously made changes. It should only be used\r\n * under extreme circumstances where damage to the file or session could happen if the currently committed are reversed. Use sparingly and with care.\r\n * Probably a good idea to alert the user it happened.\r\n */\r\n public async restartTxnSession(): Promise<void> {\r\n await IpcApp.appFunctionIpc.restartTxnSession(this._iModel.key);\r\n }\r\n\r\n /** @internal */\r\n public notifyElementsChanged(changed: NotifyEntitiesChangedArgs): void {\r\n this.onElementsChanged.raiseEvent(new EntityChanges(changed));\r\n }\r\n\r\n /** @internal */\r\n public notifyModelsChanged(changed: NotifyEntitiesChangedArgs): void {\r\n this.onModelsChanged.raiseEvent(new EntityChanges(changed));\r\n }\r\n\r\n /** @internal */\r\n public notifyGeometryGuidsChanged(changes: ModelIdAndGeometryGuid[]): void {\r\n this.onModelGeometryChanged.raiseEvent(changes);\r\n }\r\n\r\n /** @internal */\r\n public notifyCommit() {\r\n this.onCommit.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public notifyCommitted(hasPendingTxns: boolean, time: number) {\r\n this.onCommitted.raiseEvent(hasPendingTxns, time);\r\n }\r\n\r\n /** @internal */\r\n public notifyReplayExternalTxns() {\r\n this.onReplayExternalTxns.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public notifyReplayedExternalTxns() {\r\n this.onReplayedExternalTxns.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public notifyChangesApplied() {\r\n this.onChangesApplied.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public notifyBeforeUndoRedo(isUndo: boolean) {\r\n this.onBeforeUndoRedo.raiseEvent(isUndo);\r\n }\r\n\r\n /** @internal */\r\n public notifyAfterUndoRedo(isUndo: boolean) {\r\n this.onAfterUndoRedo.raiseEvent(isUndo);\r\n }\r\n\r\n /** @internal */\r\n public notifyPulledChanges(parentChangeset: ChangesetIndexAndId) {\r\n this.onChangesPulled.raiseEvent(parentChangeset);\r\n }\r\n\r\n /** @internal */\r\n public notifyPushedChanges(parentChangeset: ChangesetIndexAndId) {\r\n this.onChangesPushed.raiseEvent(parentChangeset);\r\n }\r\n\r\n /** @internal */\r\n public notifyIModelNameChanged(name: string) {\r\n this._iModel.name = name;\r\n }\r\n\r\n /** @internal */\r\n public notifyRootSubjectChanged(subject: RootSubjectProps) {\r\n this._iModel.rootSubject = subject;\r\n }\r\n\r\n /** @internal */\r\n public notifyProjectExtentsChanged(range: Range3dProps) {\r\n this._iModel.projectExtents = Range3d.fromJSON(range);\r\n }\r\n\r\n /** @internal */\r\n public notifyGlobalOriginChanged(origin: XYZProps) {\r\n this._iModel.globalOrigin = Point3d.fromJSON(origin);\r\n }\r\n\r\n /** @internal */\r\n public notifyEcefLocationChanged(ecef: EcefLocationProps | undefined) {\r\n this._iModel.ecefLocation = ecef ? new EcefLocation(ecef) : undefined;\r\n }\r\n\r\n /** @internal */\r\n public notifyGeographicCoordinateSystemChanged(gcs: GeographicCRSProps | undefined) {\r\n this._iModel.geographicCoordinateSystem = gcs ? new GeographicCRS(gcs) : undefined;\r\n }\r\n\r\n /** @internal */\r\n public notifyPullMergeBegin(changeset: ChangesetIdWithIndex) {\r\n this.onPullMergeBegin.raiseEvent(changeset);\r\n }\r\n /** @internal */\r\n public notifyPullMergeEnd(changeset: ChangesetIdWithIndex) {\r\n this.onPullMergeEnd.raiseEvent(changeset);\r\n }\r\n /** @internal */\r\n public notifyApplyIncomingChangesBegin(changes: ChangesetProps[]) {\r\n this.onApplyIncomingChangesBegin.raiseEvent(changes);\r\n }\r\n /** @internal */\r\n public notifyApplyIncomingChangesEnd(changes: ChangesetProps[]) {\r\n this.onApplyIncomingChangesEnd.raiseEvent(changes);\r\n }\r\n /** @internal */\r\n public notifyReverseLocalChangesBegin() {\r\n this.onReverseLocalChangesBegin.raiseEvent();\r\n }\r\n /** @internal */\r\n public notifyReverseLocalChangesEnd(txns: TxnProps[]) {\r\n this.onReverseLocalChangesEnd.raiseEvent(txns);\r\n }\r\n /** @internal */\r\n public notifyDownloadChangesetsBegin() {\r\n this.onDownloadChangesetsBegin.raiseEvent();\r\n }\r\n /** @internal */\r\n public notifyDownloadChangesetsEnd() {\r\n this.onDownloadChangesetsEnd.raiseEvent();\r\n }\r\n /** @internal */\r\n public notifyRebaseBegin(txns: TxnProps[]) {\r\n this.onRebaseBegin.raiseEvent(txns);\r\n }\r\n /** @internal */\r\n public notifyRebaseEnd(txns: TxnProps[]) {\r\n this.onRebaseEnd.raiseEvent(txns);\r\n }\r\n /** @internal */\r\n public notifyRebaseTxnBegin(txn: TxnProps) {\r\n this.onRebaseTxnBegin.raiseEvent(txn);\r\n }\r\n /** @internal */\r\n public notifyRebaseTxnEnd(txn: TxnProps) {\r\n this.onRebaseTxnEnd.raiseEvent(txn);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerModelCategoryVisibility.d.ts","sourceRoot":"","sources":["../../src/PerModelCategoryVisibility.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"PerModelCategoryVisibility.d.ts","sourceRoot":"","sources":["../../src/PerModelCategoryVisibility.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;GAQG;AACH,yBAAiB,0BAA0B,CAAC;IAC1C,uEAAuE;IACvE,KAAY,QAAQ;QAClB,wIAAwI;QACxI,IAAI,IAAA;QACJ,gDAAgD;QAChD,IAAI,IAAA;QACJ,kDAAkD;QAClD,IAAI,IAAA;KACL;IAED,uFAAuF;IACvF,UAAiB,aAAa;QAC5B,2EAA2E;QAC3E,QAAQ,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verrides = createOverrides;
|
|
37
37
|
})(PerModelCategoryVisibility || (exports.PerModelCategoryVisibility = PerModelCategoryVisibility = {}));
|
|
38
|
-
class PerModelCategoryVisibilityOverride {
|
|
39
|
-
modelId;
|
|
40
|
-
categoryId;
|
|
41
|
-
visible;
|
|
42
|
-
constructor(modelId, categoryId, visible) {
|
|
43
|
-
this.modelId = modelId;
|
|
44
|
-
this.categoryId = categoryId;
|
|
45
|
-
this.visible = visible;
|
|
46
|
-
}
|
|
47
|
-
reset(modelId, categoryId, visible) {
|
|
48
|
-
this.modelId = modelId;
|
|
49
|
-
this.categoryId = categoryId;
|
|
50
|
-
this.visible = visible;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function compareCategoryOverrides(lhs, rhs) {
|
|
54
|
-
const cmp = (0, core_bentley_1.compareStrings)(lhs.modelId, rhs.modelId);
|
|
55
|
-
return 0 === cmp ? (0, core_bentley_1.compareStrings)(lhs.categoryId, rhs.categoryId) : cmp;
|
|
56
|
-
}
|
|
57
38
|
/** The Viewport-specific implementation of PerModelCategoryVisibility.Overrides. */
|
|
58
|
-
class PerModelCategoryVisibilityOverrides
|
|
59
|
-
|
|
39
|
+
class PerModelCategoryVisibilityOverrides {
|
|
40
|
+
_map = new Map();
|
|
41
|
+
/** Flat set of all override entries, providing O(1) iteration via [Symbol.iterator]. Kept in sync with `_map`. */
|
|
42
|
+
_set = new Set();
|
|
60
43
|
_vp;
|
|
61
44
|
constructor(vp) {
|
|
62
|
-
super(compareCategoryOverrides);
|
|
63
45
|
this._vp = vp;
|
|
64
46
|
}
|
|
47
|
+
[Symbol.iterator]() {
|
|
48
|
+
return this._set[Symbol.iterator]();
|
|
49
|
+
}
|
|
65
50
|
getOverride(modelId, categoryId) {
|
|
66
|
-
this.
|
|
67
|
-
const ovr = this.findEqual(this._scratch);
|
|
51
|
+
const ovr = this._map.get(modelId)?.get(categoryId);
|
|
68
52
|
if (undefined !== ovr)
|
|
69
53
|
return ovr.visible ? PerModelCategoryVisibility.Override.Show : PerModelCategoryVisibility.Override.Hide;
|
|
70
54
|
else
|
|
71
55
|
return PerModelCategoryVisibility.Override.None;
|
|
72
56
|
}
|
|
57
|
+
getModelEntry({ modelId, override }) {
|
|
58
|
+
let modelEntry = this._map.get(modelId);
|
|
59
|
+
if (modelEntry) {
|
|
60
|
+
return modelEntry;
|
|
61
|
+
}
|
|
62
|
+
if (override === PerModelCategoryVisibility.Override.None) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
modelEntry = new Map();
|
|
66
|
+
this._map.set(modelId, modelEntry);
|
|
67
|
+
return modelEntry;
|
|
68
|
+
}
|
|
69
|
+
addOrRemoveOverrideEntry({ modelEntry, categoryId, modelId, override }) {
|
|
70
|
+
const overrideEntry = modelEntry.get(categoryId);
|
|
71
|
+
if (override === PerModelCategoryVisibility.Override.None) {
|
|
72
|
+
if (overrideEntry === undefined) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
this._set.delete(overrideEntry);
|
|
76
|
+
modelEntry.delete(categoryId);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
const visible = override === PerModelCategoryVisibility.Override.Show;
|
|
80
|
+
if (overrideEntry === undefined) {
|
|
81
|
+
const ovr = { modelId, categoryId, visible };
|
|
82
|
+
modelEntry.set(categoryId, ovr);
|
|
83
|
+
this._set.add(ovr);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
if (overrideEntry.visible !== visible) {
|
|
87
|
+
overrideEntry.visible = visible;
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
applyOverride(modelId, categoryIds, override, catIdsToLoad) {
|
|
93
|
+
const modelEntry = this.getModelEntry({ modelId, override });
|
|
94
|
+
let changed = false;
|
|
95
|
+
if (!modelEntry)
|
|
96
|
+
return changed;
|
|
97
|
+
for (const categoryId of categoryIds) {
|
|
98
|
+
if (this.addOrRemoveOverrideEntry({ modelEntry, categoryId, modelId, override })) {
|
|
99
|
+
changed = true;
|
|
100
|
+
if (catIdsToLoad && override !== PerModelCategoryVisibility.Override.None)
|
|
101
|
+
catIdsToLoad.push(categoryId);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (modelEntry.size === 0) {
|
|
105
|
+
this._map.delete(modelId);
|
|
106
|
+
}
|
|
107
|
+
return changed;
|
|
108
|
+
}
|
|
73
109
|
/**
|
|
74
110
|
* set the overrides for multiple perModelCategoryVisibility props, loading categoryIds from the iModel if necessary.
|
|
75
111
|
* @see [[PerModelCategoryVisibility]]
|
|
@@ -84,19 +120,11 @@ class PerModelCategoryVisibilityOverrides extends core_bentley_1.SortedArray {
|
|
|
84
120
|
const catIdsToLoad = [];
|
|
85
121
|
const iModelToUse = iModel ? iModel : this._vp.iModel;
|
|
86
122
|
for (const override of perModelCategoryVisibility) {
|
|
87
|
-
const modelId = override.modelId;
|
|
88
123
|
// The caller may pass a single categoryId as a string, if we don't convert this to an array we will iterate
|
|
89
124
|
// over each individual character of that string, which is not the desired behavior.
|
|
90
125
|
const categoryIds = typeof override.categoryIds === "string" ? [override.categoryIds] : override.categoryIds;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (this.findAndUpdateOverrideInArray(modelId, categoryId, visOverride)) {
|
|
94
|
-
anyChanged = true;
|
|
95
|
-
if (PerModelCategoryVisibility.Override.None !== visOverride) {
|
|
96
|
-
catIdsToLoad.push(categoryId);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
126
|
+
if (this.applyOverride(override.modelId, categoryIds, override.visOverride, catIdsToLoad))
|
|
127
|
+
anyChanged = true;
|
|
100
128
|
}
|
|
101
129
|
if (anyChanged) {
|
|
102
130
|
this._vp.setViewedCategoriesPerModelChanged();
|
|
@@ -104,44 +132,17 @@ class PerModelCategoryVisibilityOverrides extends core_bentley_1.SortedArray {
|
|
|
104
132
|
this._vp.subcategories.push(iModelToUse.subcategories, catIdsToLoad, () => this._vp.setViewedCategoriesPerModelChanged());
|
|
105
133
|
}
|
|
106
134
|
}
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
/** Find and update the override in the array of overrides. If override not found, adds it to the array.
|
|
110
|
-
* If the array was changed, returns true. */
|
|
111
|
-
findAndUpdateOverrideInArray(modelId, categoryId, override) {
|
|
112
|
-
const ovr = this._scratch;
|
|
113
|
-
ovr.reset(modelId, categoryId, false);
|
|
114
|
-
let changed = false;
|
|
115
|
-
const index = this.indexOf(ovr);
|
|
116
|
-
if (-1 === index) {
|
|
117
|
-
if (PerModelCategoryVisibility.Override.None !== override) {
|
|
118
|
-
this.insert(new PerModelCategoryVisibilityOverride(modelId, categoryId, PerModelCategoryVisibility.Override.Show === override));
|
|
119
|
-
changed = true;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
if (PerModelCategoryVisibility.Override.None === override) {
|
|
124
|
-
this._array.splice(index, 1);
|
|
125
|
-
changed = true;
|
|
126
|
-
}
|
|
127
|
-
else if (this._array[index].visible !== (PerModelCategoryVisibility.Override.Show === override)) {
|
|
128
|
-
this._array[index].visible = (PerModelCategoryVisibility.Override.Show === override);
|
|
129
|
-
changed = true;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return changed;
|
|
133
135
|
}
|
|
134
136
|
setOverride(modelIds, categoryIds, override) {
|
|
137
|
+
const categoryIdIterable = core_bentley_1.Id64.iterable(categoryIds);
|
|
135
138
|
let changed = false;
|
|
136
139
|
for (const modelId of core_bentley_1.Id64.iterable(modelIds)) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
changed = true;
|
|
140
|
-
}
|
|
140
|
+
if (this.applyOverride(modelId, categoryIdIterable, override))
|
|
141
|
+
changed = true;
|
|
141
142
|
}
|
|
142
143
|
if (changed) {
|
|
143
144
|
this._vp.setViewedCategoriesPerModelChanged();
|
|
144
|
-
if (PerModelCategoryVisibility.Override.None
|
|
145
|
+
if (override !== PerModelCategoryVisibility.Override.None) {
|
|
145
146
|
// Ensure subcategories loaded.
|
|
146
147
|
this._vp.subcategories.push(this._vp.iModel.subcategories, categoryIds, () => this._vp.setViewedCategoriesPerModelChanged());
|
|
147
148
|
}
|
|
@@ -149,30 +150,32 @@ class PerModelCategoryVisibilityOverrides extends core_bentley_1.SortedArray {
|
|
|
149
150
|
}
|
|
150
151
|
clearOverrides(modelIds) {
|
|
151
152
|
if (undefined === modelIds) {
|
|
152
|
-
if (
|
|
153
|
-
this.clear();
|
|
153
|
+
if (this._map.size > 0) {
|
|
154
|
+
this._map.clear();
|
|
155
|
+
this._set.clear();
|
|
154
156
|
this._vp.setViewedCategoriesPerModelChanged();
|
|
155
157
|
}
|
|
156
158
|
return;
|
|
157
159
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
160
|
+
let changed = false;
|
|
161
|
+
for (const modelId of core_bentley_1.Id64.iterable(modelIds)) {
|
|
162
|
+
const modelEntry = this._map.get(modelId);
|
|
163
|
+
if (!modelEntry) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
changed = true;
|
|
167
|
+
for (const overrideEntry of modelEntry.values()) {
|
|
168
|
+
this._set.delete(overrideEntry);
|
|
168
169
|
}
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
this._map.delete(modelId);
|
|
171
|
+
}
|
|
172
|
+
if (changed) {
|
|
173
|
+
this._vp.setViewedCategoriesPerModelChanged();
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
176
|
addOverrides(fs, ovrs) {
|
|
174
177
|
const cache = this._vp.iModel.subcategories;
|
|
175
|
-
for (const ovr of this.
|
|
178
|
+
for (const ovr of this._set) {
|
|
176
179
|
const subcats = cache.getSubCategories(ovr.categoryId);
|
|
177
180
|
if (undefined === subcats)
|
|
178
181
|
continue;
|
|
@@ -182,7 +185,6 @@ class PerModelCategoryVisibilityOverrides extends core_bentley_1.SortedArray {
|
|
|
182
185
|
/* if (!this._vp.view.viewsModel(ovr.modelId))
|
|
183
186
|
continue; */
|
|
184
187
|
// ###TODO: Avoid recomputing upper and lower portions of modelId if modelId repeated.
|
|
185
|
-
// (Array is sorted first by modelId).
|
|
186
188
|
// Also avoid computing if no effective overrides.
|
|
187
189
|
const modelLo = core_bentley_1.Id64.getLowerUint32(ovr.modelId);
|
|
188
190
|
const modelHi = core_bentley_1.Id64.getUpperUint32(ovr.modelId);
|