@itwin/core-backend 5.1.0-dev.3 → 5.1.0-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/lib/cjs/Category.d.ts +37 -0
  2. package/lib/cjs/Category.d.ts.map +1 -1
  3. package/lib/cjs/Category.js +73 -0
  4. package/lib/cjs/Category.js.map +1 -1
  5. package/lib/cjs/DisplayStyle.d.ts +5 -0
  6. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  7. package/lib/cjs/DisplayStyle.js +27 -0
  8. package/lib/cjs/DisplayStyle.js.map +1 -1
  9. package/lib/cjs/Element.d.ts +166 -10
  10. package/lib/cjs/Element.d.ts.map +1 -1
  11. package/lib/cjs/Element.js +510 -9
  12. package/lib/cjs/Element.js.map +1 -1
  13. package/lib/cjs/Entity.d.ts +41 -1
  14. package/lib/cjs/Entity.d.ts.map +1 -1
  15. package/lib/cjs/Entity.js +58 -0
  16. package/lib/cjs/Entity.js.map +1 -1
  17. package/lib/cjs/IModelDb.d.ts +19 -36
  18. package/lib/cjs/IModelDb.d.ts.map +1 -1
  19. package/lib/cjs/IModelDb.js +129 -69
  20. package/lib/cjs/IModelDb.js.map +1 -1
  21. package/lib/cjs/IModelHost.d.ts +13 -0
  22. package/lib/cjs/IModelHost.d.ts.map +1 -1
  23. package/lib/cjs/IModelHost.js +6 -0
  24. package/lib/cjs/IModelHost.js.map +1 -1
  25. package/lib/cjs/Material.d.ts +19 -0
  26. package/lib/cjs/Material.d.ts.map +1 -1
  27. package/lib/cjs/Material.js +29 -0
  28. package/lib/cjs/Material.js.map +1 -1
  29. package/lib/cjs/Model.d.ts +42 -6
  30. package/lib/cjs/Model.d.ts.map +1 -1
  31. package/lib/cjs/Model.js +93 -5
  32. package/lib/cjs/Model.js.map +1 -1
  33. package/lib/cjs/TxnManager.d.ts.map +1 -1
  34. package/lib/cjs/TxnManager.js +1 -0
  35. package/lib/cjs/TxnManager.js.map +1 -1
  36. package/lib/cjs/ViewDefinition.d.ts +100 -0
  37. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  38. package/lib/cjs/ViewDefinition.js +208 -0
  39. package/lib/cjs/ViewDefinition.js.map +1 -1
  40. package/lib/cjs/ViewStateHydrator.js +3 -3
  41. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  42. package/lib/cjs/internal/ElementLRUCache.d.ts +28 -0
  43. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -0
  44. package/lib/cjs/internal/ElementLRUCache.js +120 -0
  45. package/lib/cjs/internal/ElementLRUCache.js.map +1 -0
  46. package/lib/cjs/internal/Symbols.d.ts +1 -0
  47. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  48. package/lib/cjs/internal/Symbols.js +2 -1
  49. package/lib/cjs/internal/Symbols.js.map +1 -1
  50. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +2 -2
  51. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  52. package/lib/esm/Category.d.ts +37 -0
  53. package/lib/esm/Category.d.ts.map +1 -1
  54. package/lib/esm/Category.js +73 -0
  55. package/lib/esm/Category.js.map +1 -1
  56. package/lib/esm/DisplayStyle.d.ts +5 -0
  57. package/lib/esm/DisplayStyle.d.ts.map +1 -1
  58. package/lib/esm/DisplayStyle.js +27 -0
  59. package/lib/esm/DisplayStyle.js.map +1 -1
  60. package/lib/esm/Element.d.ts +166 -10
  61. package/lib/esm/Element.d.ts.map +1 -1
  62. package/lib/esm/Element.js +513 -12
  63. package/lib/esm/Element.js.map +1 -1
  64. package/lib/esm/Entity.d.ts +41 -1
  65. package/lib/esm/Entity.d.ts.map +1 -1
  66. package/lib/esm/Entity.js +58 -0
  67. package/lib/esm/Entity.js.map +1 -1
  68. package/lib/esm/IModelDb.d.ts +19 -36
  69. package/lib/esm/IModelDb.d.ts.map +1 -1
  70. package/lib/esm/IModelDb.js +132 -72
  71. package/lib/esm/IModelDb.js.map +1 -1
  72. package/lib/esm/IModelHost.d.ts +13 -0
  73. package/lib/esm/IModelHost.d.ts.map +1 -1
  74. package/lib/esm/IModelHost.js +6 -0
  75. package/lib/esm/IModelHost.js.map +1 -1
  76. package/lib/esm/Material.d.ts +19 -0
  77. package/lib/esm/Material.d.ts.map +1 -1
  78. package/lib/esm/Material.js +30 -1
  79. package/lib/esm/Material.js.map +1 -1
  80. package/lib/esm/Model.d.ts +42 -6
  81. package/lib/esm/Model.d.ts.map +1 -1
  82. package/lib/esm/Model.js +94 -6
  83. package/lib/esm/Model.js.map +1 -1
  84. package/lib/esm/TxnManager.d.ts.map +1 -1
  85. package/lib/esm/TxnManager.js +1 -0
  86. package/lib/esm/TxnManager.js.map +1 -1
  87. package/lib/esm/ViewDefinition.d.ts +100 -0
  88. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  89. package/lib/esm/ViewDefinition.js +209 -1
  90. package/lib/esm/ViewDefinition.js.map +1 -1
  91. package/lib/esm/ViewStateHydrator.js +3 -3
  92. package/lib/esm/ViewStateHydrator.js.map +1 -1
  93. package/lib/esm/internal/ElementLRUCache.d.ts +28 -0
  94. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -0
  95. package/lib/esm/internal/ElementLRUCache.js +116 -0
  96. package/lib/esm/internal/ElementLRUCache.js.map +1 -0
  97. package/lib/esm/internal/Symbols.d.ts +1 -0
  98. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  99. package/lib/esm/internal/Symbols.js +1 -0
  100. package/lib/esm/internal/Symbols.js.map +1 -1
  101. package/lib/esm/rpc-impl/IModelReadRpcImpl.js +2 -2
  102. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  103. package/lib/esm/test/ElementLRUCache.test.d.ts +2 -0
  104. package/lib/esm/test/ElementLRUCache.test.d.ts.map +1 -0
  105. package/lib/esm/test/ElementLRUCache.test.js +212 -0
  106. package/lib/esm/test/ElementLRUCache.test.js.map +1 -0
  107. package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -23
  108. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  109. package/lib/esm/test/imodel/IModel.test.js +22 -11
  110. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  111. package/lib/esm/test/standalone/SnapshotDb.test.js +1 -0
  112. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  113. package/lib/esm/test/standalone/TxnManager.test.js +1 -1
  114. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  115. package/package.json +12 -12
@@ -50,6 +50,7 @@ const IModelDbFontsImpl_1 = require("./internal/IModelDbFontsImpl");
50
50
  const Symbols_1 = require("./internal/Symbols");
51
51
  const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
52
52
  const Schema_1 = require("./Schema");
53
+ const ElementLRUCache_1 = require("./internal/ElementLRUCache");
53
54
  // spell:ignore fontid fontmap
54
55
  const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelDb;
55
56
  /** @internal */
@@ -579,6 +580,8 @@ class IModelDb extends core_common_1.IModel {
579
580
  this._jsClassMap = undefined;
580
581
  this._schemaMap = undefined;
581
582
  this._schemaContext = undefined;
583
+ this.elements[Symbols_1._cache].clear();
584
+ this.models[Symbols_1._cache].clear();
582
585
  }
583
586
  /** Update the project extents for this iModel.
584
587
  * <p><em>Example:</em>
@@ -979,6 +982,24 @@ class IModelDb extends core_common_1.IModel {
979
982
  return ClassRegistry_1.ClassRegistry.getClass(classFullName, this);
980
983
  }
981
984
  }
985
+ /** Constructs a ResolveInstanceKeyArgs from given parameters
986
+ * @throws [[IModelError]] if the combination of supplied parameters is invalid.
987
+ * @internal
988
+ */
989
+ getInstanceArgs(instanceId, baseClassName, federationGuid, code) {
990
+ if (instanceId && baseClassName) {
991
+ return { partialKey: { id: instanceId, baseClassName } };
992
+ }
993
+ else if (federationGuid) {
994
+ return { federationGuid };
995
+ }
996
+ else if (code) {
997
+ return { code };
998
+ }
999
+ else {
1000
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.InvalidId, "Either instanceId and baseClassName or federationGuid or code must be specified");
1001
+ }
1002
+ }
982
1003
  /** Get metadata for a class. This method will load the metadata from the iModel into the cache as a side-effect, if necessary.
983
1004
  * @throws [[IModelError]] if the metadata cannot be found nor loaded.
984
1005
  * @deprecated in 5.0. Please use `getSchemaItem` from `SchemaContext` class instead.
@@ -1462,6 +1483,8 @@ function processSchemaWriteStatus(status) {
1462
1483
  class Models {
1463
1484
  _iModel;
1464
1485
  /** @internal */
1486
+ [Symbols_1._cache] = new core_bentley_1.LRUMap(500);
1487
+ /** @internal */
1465
1488
  constructor(_iModel) {
1466
1489
  this._iModel = _iModel;
1467
1490
  }
@@ -1471,7 +1494,10 @@ function processSchemaWriteStatus(status) {
1471
1494
  * @see tryGetModelProps
1472
1495
  */
1473
1496
  getModelProps(id) {
1474
- return this.getModelJson({ id });
1497
+ const model = this.tryGetModelProps(id);
1498
+ if (undefined === model)
1499
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NotFound, `Model=${id}`);
1500
+ return model;
1475
1501
  }
1476
1502
  /** Get the ModelProps with the specified identifier.
1477
1503
  * @param modelId The Model identifier.
@@ -1481,7 +1507,25 @@ function processSchemaWriteStatus(status) {
1481
1507
  * @see getModelProps
1482
1508
  */
1483
1509
  tryGetModelProps(id) {
1484
- return this.tryGetModelJson({ id });
1510
+ try {
1511
+ if (IModelHost_1.IModelHost.configuration?.disableThinnedNativeInstanceWorkflow) {
1512
+ return this._iModel[Symbols_1._nativeDb].getModel({ id });
1513
+ }
1514
+ const cachedMdl = this[Symbols_1._cache].get(id);
1515
+ if (cachedMdl) {
1516
+ return cachedMdl;
1517
+ }
1518
+ const options = { useJsNames: true };
1519
+ const instanceKey = this.resolveModelKey({ id });
1520
+ const rawInstance = this._iModel[Symbols_1._nativeDb].readInstance(instanceKey, options);
1521
+ const classDef = this._iModel.getJsClass(rawInstance.classFullName);
1522
+ const modelProps = classDef.deserialize({ row: rawInstance, iModel: this._iModel });
1523
+ this[Symbols_1._cache].set(id, modelProps);
1524
+ return modelProps;
1525
+ }
1526
+ catch {
1527
+ return undefined;
1528
+ }
1485
1529
  }
1486
1530
  /** Query for the last modified time for a [[Model]].
1487
1531
  * @param modelId The Id of the model.
@@ -1528,32 +1572,22 @@ function processSchemaWriteStatus(status) {
1528
1572
  return model; // modelClass was not specified, cannot call instanceof to validate
1529
1573
  return model instanceof modelClass ? model : undefined;
1530
1574
  }
1531
- /** Read the properties for a Model as a json string.
1532
- * @param modelIdArg a json string with the identity of the model to load. Must have either "id" or "code".
1533
- * @returns a json string with the properties of the model.
1534
- * @throws [[IModelError]] if the model is not found or cannot be loaded.
1535
- * @see tryGetModelJson
1536
- * @internal
1537
- */
1538
- getModelJson(modelIdArg) {
1539
- const modelJson = this.tryGetModelJson(modelIdArg);
1540
- if (undefined === modelJson) {
1541
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NotFound, `Model=(id: ${modelIdArg.id}, code: ${modelIdArg.code})`);
1575
+ resolveModelKey(modelIdArg) {
1576
+ const baseClassName = "BisCore:Model";
1577
+ let args;
1578
+ if (modelIdArg.id) {
1579
+ args = { partialKey: { id: modelIdArg.id, baseClassName } };
1542
1580
  }
1543
- return modelJson;
1544
- }
1545
- /** Read the properties for a Model as a json string.
1546
- * @param modelIdArg a json string with the identity of the model to load. Must have either "id" or "code".
1547
- * @returns a json string with the properties of the model or `undefined` if the model is not found.
1548
- * @see getModelJson
1549
- */
1550
- tryGetModelJson(modelIdArg) {
1551
- try {
1552
- return this._iModel[Symbols_1._nativeDb].getModel(modelIdArg);
1581
+ else if (modelIdArg.code) {
1582
+ const modelId = this._iModel.elements.getElementProps({ code: modelIdArg.code }).id;
1583
+ if (!modelId)
1584
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NotFound, `Model not found with code: [spec:${modelIdArg.code.spec}, scope:${modelIdArg.code.scope}, value:${modelIdArg.code.value}])`);
1585
+ args = { partialKey: { id: modelId, baseClassName } };
1553
1586
  }
1554
- catch {
1555
- return undefined;
1587
+ else {
1588
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.InvalidId, `Invalid model identifier: ${JSON.stringify(modelIdArg)}`);
1556
1589
  }
1590
+ return this._iModel[Symbols_1._nativeDb].resolveInstanceKey(args);
1557
1591
  }
1558
1592
  /** Get the sub-model of the specified Element.
1559
1593
  * See [[IModelDb.Elements.queryElementIdByCode]] for more on how to find an element by Code.
@@ -1606,6 +1640,8 @@ function processSchemaWriteStatus(status) {
1606
1640
  */
1607
1641
  updateModel(props) {
1608
1642
  try {
1643
+ if (props.id)
1644
+ this[Symbols_1._cache].delete(props.id);
1609
1645
  this._iModel[Symbols_1._nativeDb].updateModel(props);
1610
1646
  }
1611
1647
  catch (err) {
@@ -1622,6 +1658,7 @@ function processSchemaWriteStatus(status) {
1622
1658
  * @see [[TxnManager.onModelGeometryChanged]] for the event emitted in response to such a change.
1623
1659
  */
1624
1660
  updateGeometryGuid(modelId) {
1661
+ this._iModel.models[Symbols_1._cache].delete(modelId);
1625
1662
  const error = this._iModel[Symbols_1._nativeDb].updateModelGeometryGuid(modelId);
1626
1663
  if (error !== core_bentley_1.IModelStatus.Success)
1627
1664
  throw new core_common_1.IModelError(error, `updating geometry guid for model ${modelId}`);
@@ -1633,6 +1670,7 @@ function processSchemaWriteStatus(status) {
1633
1670
  deleteModel(ids) {
1634
1671
  core_bentley_1.Id64.toIdSet(ids).forEach((id) => {
1635
1672
  try {
1673
+ this[Symbols_1._cache].delete(id);
1636
1674
  this._iModel[Symbols_1._nativeDb].deleteModel(id);
1637
1675
  }
1638
1676
  catch (err) {
@@ -1671,6 +1709,8 @@ function processSchemaWriteStatus(status) {
1671
1709
  class Elements {
1672
1710
  _iModel;
1673
1711
  /** @internal */
1712
+ [Symbols_1._cache] = new ElementLRUCache_1.ElementLRUCache();
1713
+ /** @internal */
1674
1714
  constructor(_iModel) {
1675
1715
  this._iModel = _iModel;
1676
1716
  }
@@ -1686,50 +1726,40 @@ function processSchemaWriteStatus(status) {
1686
1726
  return !stmt.nextRow() ? undefined : stmt.getValueId(0);
1687
1727
  }) : undefined;
1688
1728
  }
1689
- /** Read element data from the iModel as JSON
1690
- * @param elementIdArg a json string with the identity of the element to load. Must have one of "id", "federationGuid", or "code".
1691
- * @returns The JSON properties of the element.
1692
- * @throws [[IModelError]] if the element is not found or cannot be loaded.
1693
- * @see tryGetElementJson
1694
- * @internal
1695
- */
1696
- getElementJson(elementId) {
1697
- const elementProps = this.tryGetElementJson(elementId);
1698
- if (undefined === elementProps)
1699
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NotFound, `reading element={id: ${elementId.id} federationGuid: ${elementId.federationGuid}, code: ${elementId.code}}`);
1700
- return elementProps;
1701
- }
1702
- /** Read element data from the iModel as JSON
1703
- * @param loadProps - a json string with the identity of the element to load. Must have one of "id", "federationGuid", or "code".
1704
- * @returns The JSON properties of the element or `undefined` if the element is not found.
1705
- * @throws [[IModelError]] if the element exists, but cannot be loaded.
1706
- * @see getElementJson
1707
- */
1708
- tryGetElementJson(loadProps) {
1709
- try {
1710
- return this._iModel[Symbols_1._nativeDb].getElement(loadProps);
1711
- }
1712
- catch {
1713
- return undefined;
1714
- }
1715
- }
1716
1729
  /** Get properties of an Element by Id, FederationGuid, or Code
1717
1730
  * @throws [[IModelError]] if the element is not found or cannot be loaded.
1718
1731
  * @see tryGetElementProps
1719
1732
  */
1720
1733
  getElementProps(props) {
1734
+ const elProp = this.tryGetElementProps(props);
1735
+ if (undefined === elProp)
1736
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NotFound, `element not found`);
1737
+ return elProp;
1738
+ }
1739
+ resolveElementKey(props) {
1740
+ const baseClassName = "BisCore:Element";
1741
+ let args;
1721
1742
  if (typeof props === "string") {
1722
- props = core_bentley_1.Id64.isId64(props) ? { id: props } : { federationGuid: props };
1743
+ args = core_bentley_1.Id64.isId64(props) ? { partialKey: { id: props, baseClassName } } : { federationGuid: props };
1723
1744
  }
1724
1745
  else if (props instanceof core_common_1.Code) {
1725
- props = { code: props };
1746
+ args = { code: props };
1726
1747
  }
1727
- try {
1728
- return this._iModel[Symbols_1._nativeDb].getElement(props);
1729
- }
1730
- catch (err) {
1731
- throw new core_common_1.IModelError(err.errorNumber, err.message);
1748
+ else {
1749
+ if (props.id) {
1750
+ args = { partialKey: { id: props.id, baseClassName } };
1751
+ }
1752
+ else if (props.federationGuid) {
1753
+ args = { federationGuid: props.federationGuid };
1754
+ }
1755
+ else if (props.code) {
1756
+ args = { code: props.code };
1757
+ }
1758
+ else {
1759
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.InvalidId, "Element Id or FederationGuid or Code is required");
1760
+ }
1732
1761
  }
1762
+ return this._iModel[Symbols_1._nativeDb].resolveInstanceKey(args);
1733
1763
  }
1734
1764
  /** Get properties of an Element by Id, FederationGuid, or Code
1735
1765
  * @returns The properties of the element or `undefined` if the element is not found.
@@ -1737,14 +1767,32 @@ function processSchemaWriteStatus(status) {
1737
1767
  * @note Useful for cases when an element may or may not exist and throwing an `Error` would be overkill.
1738
1768
  * @see getElementProps
1739
1769
  */
1740
- tryGetElementProps(elementId) {
1741
- if (typeof elementId === "string") {
1742
- elementId = core_bentley_1.Id64.isId64(elementId) ? { id: elementId } : { federationGuid: elementId };
1770
+ tryGetElementProps(props) {
1771
+ if (typeof props === "string") {
1772
+ props = core_bentley_1.Id64.isId64(props) ? { id: props } : { federationGuid: props };
1743
1773
  }
1744
- else if (elementId instanceof core_common_1.Code) {
1745
- elementId = { code: elementId };
1774
+ else if (props instanceof core_common_1.Code) {
1775
+ props = { code: props };
1776
+ }
1777
+ try {
1778
+ if (IModelHost_1.IModelHost.configuration?.disableThinnedNativeInstanceWorkflow) {
1779
+ return this._iModel[Symbols_1._nativeDb].getElement(props);
1780
+ }
1781
+ const cachedElm = this[Symbols_1._cache].get(props);
1782
+ if (cachedElm) {
1783
+ return cachedElm.elProps;
1784
+ }
1785
+ const options = { ...props, useJsNames: true };
1786
+ const instanceKey = this.resolveElementKey(props);
1787
+ const rawInstance = this._iModel[Symbols_1._nativeDb].readInstance(instanceKey, options);
1788
+ const classDef = this._iModel.getJsClass(rawInstance.classFullName);
1789
+ const elementProps = classDef.deserialize({ row: rawInstance, iModel: this._iModel, options: { element: props } });
1790
+ this[Symbols_1._cache].set({ elProps: elementProps, loadOptions: props });
1791
+ return elementProps;
1792
+ }
1793
+ catch {
1794
+ return undefined;
1746
1795
  }
1747
- return this.tryGetElementJson(elementId);
1748
1796
  }
1749
1797
  /** Get an element by Id, FederationGuid, or Code
1750
1798
  * @param elementId either the element's Id, Code, or FederationGuid, or an ElementLoadProps
@@ -1777,7 +1825,7 @@ function processSchemaWriteStatus(status) {
1777
1825
  elementId = { code: elementId };
1778
1826
  else
1779
1827
  elementId.onlyBaseProperties = false; // we must load all properties to construct the element.
1780
- const elementProps = this.tryGetElementJson(elementId);
1828
+ const elementProps = this.tryGetElementProps(elementId);
1781
1829
  if (undefined === elementProps)
1782
1830
  return undefined; // no Element with that elementId found
1783
1831
  const element = this._iModel.constructEntity(elementProps);
@@ -1841,6 +1889,11 @@ function processSchemaWriteStatus(status) {
1841
1889
  */
1842
1890
  insertElement(elProps, options) {
1843
1891
  try {
1892
+ this[Symbols_1._cache].delete({
1893
+ id: elProps.id,
1894
+ federationGuid: elProps.federationGuid,
1895
+ code: elProps.code,
1896
+ });
1844
1897
  return elProps.id = this._iModel[Symbols_1._nativeDb].insertElement(elProps, options);
1845
1898
  }
1846
1899
  catch (err) {
@@ -1862,6 +1915,11 @@ function processSchemaWriteStatus(status) {
1862
1915
  */
1863
1916
  updateElement(elProps) {
1864
1917
  try {
1918
+ this[Symbols_1._cache].delete({
1919
+ id: elProps.id,
1920
+ federationGuid: elProps.federationGuid,
1921
+ code: elProps.code,
1922
+ });
1865
1923
  this._iModel[Symbols_1._nativeDb].updateElement(elProps);
1866
1924
  }
1867
1925
  catch (err) {
@@ -1879,6 +1937,7 @@ function processSchemaWriteStatus(status) {
1879
1937
  const iModel = this._iModel;
1880
1938
  core_bentley_1.Id64.toIdSet(ids).forEach((id) => {
1881
1939
  try {
1940
+ this[Symbols_1._cache].delete({ id });
1882
1941
  iModel[Symbols_1._nativeDb].deleteElement(id);
1883
1942
  }
1884
1943
  catch (err) {
@@ -2381,9 +2440,9 @@ function processSchemaWriteStatus(status) {
2381
2440
  }
2382
2441
  IModelDb.Views = Views;
2383
2442
  /** Represents the current state of a pollable tile content request.
2384
- * Note: lack of a "completed" state because polling a completed request returns the content as a Uint8Array.
2385
- * @internal
2386
- */
2443
+ * Note: lack of a "completed" state because polling a completed request returns the content as a Uint8Array.
2444
+ * @internal
2445
+ */
2387
2446
  let TileContentState;
2388
2447
  (function (TileContentState) {
2389
2448
  TileContentState[TileContentState["New"] = 0] = "New";
@@ -2632,6 +2691,7 @@ class BriefcaseDb extends IModelDb {
2632
2691
  touch.sync(briefcaseDb.watchFilePathName);
2633
2692
  // Restart default txn to trigger events when watch file is changed by some other process.
2634
2693
  const watcher = fs.watch(briefcaseDb.watchFilePathName, { persistent: false }, () => {
2694
+ nativeDb.clearECDbCache();
2635
2695
  nativeDb.restartDefaultTxn();
2636
2696
  briefcaseDb.changeset = briefcaseDb[Symbols_1._nativeDb].getCurrentChangeset();
2637
2697
  });