@itwin/core-backend 4.0.0-dev.70 → 4.0.0-dev.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,38 @@
1
1
  # Change Log - @itwin/core-backend
2
2
 
3
- This log was last generated on Wed, 08 Feb 2023 14:58:39 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 12 Apr 2023 13:12:42 GMT and should not be manually modified.
4
+
5
+ ## 3.7.2
6
+ Wed, 12 Apr 2023 13:12:42 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 3.7.1
11
+ Mon, 03 Apr 2023 15:15:36 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 3.7.0
16
+ Wed, 29 Mar 2023 15:02:27 GMT
17
+
18
+ ### Updates
19
+
20
+ - Deprecate IModelDb's and ECDb's query, queryRowCount, and restartQuery methods.
21
+
22
+ ## 3.6.3
23
+ Mon, 27 Mar 2023 16:26:47 GMT
24
+
25
+ _Version update only_
26
+
27
+ ## 3.6.2
28
+ Fri, 17 Mar 2023 17:52:32 GMT
29
+
30
+ _Version update only_
31
+
32
+ ## 3.6.1
33
+ Fri, 24 Feb 2023 22:00:48 GMT
34
+
35
+ _Version update only_
4
36
 
5
37
  ## 3.6.0
6
38
  Wed, 08 Feb 2023 14:58:39 GMT
@@ -518,7 +550,7 @@ Mon, 26 Jul 2021 12:21:25 GMT
518
550
 
519
551
  - Reactivated test that stopped working when a previous PR for ecef dependency to geographicCRS was reverted
520
552
  - store changesetIndex on IModelDb
521
- - Better error checks when creating SpatialViewDefinition-s.
553
+ - Better error checks when creating SpatialViewDefinition-s.
522
554
  - remove internal barrel-import usage
523
555
  - throw exception when attempting to download a briefcase on top of an existing file
524
556
  - Add case for InterpolationCurve3d
@@ -553,11 +585,11 @@ Fri, 09 Jul 2021 18:11:24 GMT
553
585
  ### Updates
554
586
 
555
587
  - TemplateModelCloner now assigns a new FederationGuid for cloned element instances.
556
- - Accomodated the inability to reverse Changesets when creating change summaries.
588
+ - Accomodated the inability to reverse Changesets when creating change summaries.
557
589
  - fix lint issue
558
590
  - begin api transition to changeset index rather than changeset Id
559
591
  - Use ecef location calculated for projected iModels
560
- - Push refreshes access token if necessary.
592
+ - Push refreshes access token if necessary.
561
593
  - Do not reuse briefcase ids in ReadWrite workflows when using the RPC interfaces (if the briefcase was not found in the local file system)
562
594
  - Add missing SectionDrawing properties.
563
595
 
@@ -578,7 +610,7 @@ Fri, 02 Jul 2021 15:38:31 GMT
578
610
 
579
611
  ### Updates
580
612
 
581
- - Update to @bentley/imodeljs-native@2.17.10
613
+ - Update to @bentley/imodeljs-native@2.17.10
582
614
 
583
615
  ## 2.17.0
584
616
  Mon, 28 Jun 2021 16:20:11 GMT
@@ -844,8 +876,8 @@ Thu, 28 Jan 2021 13:39:27 GMT
844
876
 
845
877
  - Changed storageType from azure to azure?sas=1 for getCommandArgs function
846
878
  - Fix brep DataProps to/from flatbuffer to account for base64 string header.
847
- - Element geometry creation by brep operations.
848
- - Reinstated behavior when re-opening files read-write.
879
+ - Element geometry creation by brep operations.
880
+ - Reinstated behavior when re-opening files read-write.
849
881
  - enhance BriefcaseManager and BriefcaseDb for edit commands
850
882
  - Improve ElementGeometry documentation.
851
883
  - Add a check to verify, and fix, the DbGuid in the iModel if it is different than the Guid in iModelHub.
@@ -1035,8 +1067,8 @@ Fri, 02 Oct 2020 18:03:32 GMT
1035
1067
  ### Updates
1036
1068
 
1037
1069
  - Update to @bentley/imodeljs-native@2.7.4
1038
- - Fixes to front end methods to pull, merge and push.
1039
- - Setup IModelHost.startup() to use proxy servers if configured/available - this is valuable for debugging agents, backends and electron applications.
1070
+ - Fixes to front end methods to pull, merge and push.
1071
+ - Setup IModelHost.startup() to use proxy servers if configured/available - this is valuable for debugging agents, backends and electron applications.
1040
1072
  - On iOS download in background
1041
1073
  - Fix ios hang issue
1042
1074
  - Modify queryModelRanges to handle non geometric model errors
@@ -1127,7 +1159,7 @@ Thu, 20 Aug 2020 20:57:09 GMT
1127
1159
  ### Updates
1128
1160
 
1129
1161
  - Update to imodeljs-native 2.5.0
1130
- - VSTS#419723: Accomodated "bad" checkpoints that may have serialized transactions preventing their use in ReadWrite cases.
1162
+ - VSTS#419723: Accomodated "bad" checkpoints that may have serialized transactions preventing their use in ReadWrite cases.
1131
1163
  - Fix for a recursive exception while closing a briefcase
1132
1164
  - Added mobile oidc client
1133
1165
  - Remove special code handling for mobile.
@@ -1191,7 +1223,7 @@ Fri, 10 Jul 2020 17:23:14 GMT
1191
1223
  - Changes to support imodel-bridge
1192
1224
  - fix spelling mistakes in Device class
1193
1225
  - Fix typo in comments
1194
- - Setup BriefcaseDb.open() to allow profile and domain schema validation and upgrades.
1226
+ - Setup BriefcaseDb.open() to allow profile and domain schema validation and upgrades.
1195
1227
  - disallow protected operations for missing schemas marked with SchemaHasBehavior custom attribute
1196
1228
 
1197
1229
  ## 2.2.1
@@ -1232,25 +1264,25 @@ Thu, 28 May 2020 22:48:59 GMT
1232
1264
  - Update to imodeljs-native 2.1.0
1233
1265
  - Support for finding an ExternalSourceAspect given scope, id, and kind/hash.
1234
1266
  - ApplyChangeset perf tests updated
1235
- - Fixed token expiry check for desktop authorization.
1267
+ - Fixed token expiry check for desktop authorization.
1236
1268
  - Download ChangeSets in chunks
1237
1269
  - (1) In xy region booleans, support curved edges; (2) ExportGraphicsMeshVisitor class
1238
1270
  - Add ability to convert ExportGraphicsMesh to Polyface
1239
1271
  - Fixed validation of Guids (ContextId, IModelId) cached within a briefcase.
1240
1272
  - Moved iModelBridgeFwk to a separate package
1241
- - Simplified logging for monitoring briefcase operations.
1273
+ - Simplified logging for monitoring briefcase operations.
1242
1274
  - Fix transforms for creating and querying part instance geometry in world coordinate.
1243
1275
  - Fix and improvement to performance tests
1244
1276
  - Added support for schema XML import to iModelJs backend via the IModelDb.importSchemaStrings method.
1245
1277
  - channel rules
1246
- - Fixed logging usage when opening connections.
1278
+ - Fixed logging usage when opening connections.
1247
1279
 
1248
1280
  ## 2.0.0
1249
1281
  Wed, 06 May 2020 13:17:49 GMT
1250
1282
 
1251
1283
  ### Updates
1252
1284
 
1253
- - Fixed setup of UserInfo from browser clients, and more cleanups to AccessToken API.
1285
+ - Fixed setup of UserInfo from browser clients, and more cleanups to AccessToken API.
1254
1286
  - Added RivisionUtility class for debug/testing
1255
1287
  - node addon 2.0.18
1256
1288
  - addon 2.0.25
@@ -1263,23 +1295,23 @@ Wed, 06 May 2020 13:17:49 GMT
1263
1295
  - Performance tests for Applying Changesets
1264
1296
  - `IModelHost.startup` is now async.
1265
1297
  - `IModelHost.shutdown` is now async.
1266
- - Refined checks for briefcase id, and fixed failing integration tests.
1298
+ - Refined checks for briefcase id, and fixed failing integration tests.
1267
1299
  - Product Backlog Item 276268: Deleting the briefcase cache if the cache version is incorrect should not attempt to delete the root directory.
1268
1300
  - Setup initialization of briefcase cache for offline workflows. (VSTS#286489)
1269
- - Monitor progress of downloading briefcases, ability to cancel download of briefcases.
1301
+ - Monitor progress of downloading briefcases, ability to cancel download of briefcases.
1270
1302
  - Move briefcase-specific events into BriefcaseIModelDb subclass
1271
1303
  - Fixed param when calling logger so that it is a function as the logger expects
1272
- - Setup a common cache locaton for iModel.js, with briefcases taking up a sub-folder.
1304
+ - Setup a common cache locaton for iModel.js, with briefcases taking up a sub-folder.
1273
1305
  - Changed ChangeSets download API
1274
1306
  - Added unlink for file handler
1275
1307
  - Update UlasClient tests to send more detailed feature log data
1276
1308
  - react to renaming of imodeljs-clients-backend to backend-itwin-client
1277
1309
  - apply changeset performance tests with local datasets
1278
- - BriefcaseManager.delete should work in offline scenarios.
1310
+ - BriefcaseManager.delete should work in offline scenarios.
1279
1311
  - Remove deprecated members of SectionLocation and downgrade to alpha pending refactor.
1280
1312
  - Support for progress/cancel from ios
1281
1313
  - Remove deprecated ExportGraphics types etc for 2.0
1282
- - Updated docs.
1314
+ - Updated docs.
1283
1315
  - IModelDb.findByKey replaces IModelDb.find
1284
1316
  - Include model extents with ViewStateProps for drawing views.
1285
1317
  - Remove deprecated APIs; see NextVersion.md for details.
@@ -1300,29 +1332,29 @@ Wed, 06 May 2020 13:17:49 GMT
1300
1332
  - Introduce the BriefcaseIModelDb class, make IModelDb abstract.
1301
1333
  - Cleaned up unused async-s in BriefcaseManager
1302
1334
  - Avoided casting of BriefcaseProps to IModelRpcProps.
1303
- - Added NativeApp.deleteBriefcase, avoided authorization exceptions when offline.
1335
+ - Added NativeApp.deleteBriefcase, avoided authorization exceptions when offline.
1304
1336
  - Move briefcase property from IModelDb --> BriefcaseIModelDb
1305
1337
  - BriefcaseId is now an enum instead of a class
1306
1338
  - Rename BriefcaseId --> ReservedBriefcaseId, introduce BriefcaseId type
1307
- - VSTS#297017: Update cached briefcase information if changes were applied.
1308
- - Refactored NativeApp API and RPC interfaces. This continues to be WIP.
1309
- - Removed the call to simultaneously download and open the briefcase at the backend. This should be done in two separate steps henceforth. The download must be done with BriefcaseManager, and the open is now a synchronous call in BriefcaseDb.
1310
- - Added DownloadBriefcaseOptions and OpenBriefcaseOptions as parameters to the download/open calls for a briefcase.
1339
+ - VSTS#297017: Update cached briefcase information if changes were applied.
1340
+ - Refactored NativeApp API and RPC interfaces. This continues to be WIP.
1341
+ - Removed the call to simultaneously download and open the briefcase at the backend. This should be done in two separate steps henceforth. The download must be done with BriefcaseManager, and the open is now a synchronous call in BriefcaseDb.
1342
+ - Added DownloadBriefcaseOptions and OpenBriefcaseOptions as parameters to the download/open calls for a briefcase.
1311
1343
  - Removed BriefcaseDb.create
1312
- - Setup ability to use NativeApp.openBriefcase() in offline scenarios.
1344
+ - Setup ability to use NativeApp.openBriefcase() in offline scenarios.
1313
1345
  - fixed flaky test
1314
- - VSTS#217447, 162382: Cleanups to implementation of downloading/opening/discovering briefcases in native applications (WIP).
1346
+ - VSTS#217447, 162382: Cleanups to implementation of downloading/opening/discovering briefcases in native applications (WIP).
1315
1347
  - do not throw exception in NativeAppBackend.startup()
1316
- - VSTS#296110: Setup a way to close briefcases when the native application is offline.
1348
+ - VSTS#296110: Setup a way to close briefcases when the native application is offline.
1317
1349
  - Move concurrencyControl from IModelDb to BriefcaseIModelDb
1318
1350
  - Renamed OIDC constructs for consistency; Removed SAML support.
1319
1351
  - Add support for password-protecting snapshot iModels
1320
1352
  - Fixed typo for ElementAspect perf tests
1321
- - VSTS#217447, VSTS#162382: Reinstated option to open briefcases with SyncMode = PullOnly.
1353
+ - VSTS#217447, VSTS#162382: Reinstated option to open briefcases with SyncMode = PullOnly.
1322
1354
  - Add purge dir method to iModelJsFs
1323
1355
  - react to creation of new clients packages from imodeljs-clients
1324
1356
  - ; substitute current date for feature usage without any set start/end dates
1325
- - Removed deprecated utilities.
1357
+ - Removed deprecated utilities.
1326
1358
  - enforce opening Snapshots readonly through StandaloneDb
1327
1359
  - Remove the deprecated Entity.clone method
1328
1360
  - Adjusted calls to some node addon changes (ECUtils removed)
@@ -1334,13 +1366,13 @@ Wed, 06 May 2020 13:17:49 GMT
1334
1366
  - Add FileNameResolver class
1335
1367
  - Move snapshot methods out of IModelDb and into new SnapshotIModelDb class.
1336
1368
  - Add TemplateModelCloner to place instances of a template model
1337
- - Renamed TestOidcClient and related constructs for consistency.
1369
+ - Renamed TestOidcClient and related constructs for consistency.
1338
1370
  - Add IModelDb.tryPrepareStatement
1339
- - Fixed usage logging.
1371
+ - Fixed usage logging.
1340
1372
  - fix failing ulas tests due to invalid featureId
1341
1373
  - update ULAS test logging & feedback
1342
1374
  - Update UlasUtilities to support exception-throwing native functions
1343
- - Use standalone briefcases for PullOnly cases.
1375
+ - Use standalone briefcases for PullOnly cases.
1344
1376
 
1345
1377
  ## 1.14.1
1346
1378
  Wed, 22 Apr 2020 19:04:00 GMT
@@ -1355,7 +1387,7 @@ Tue, 31 Mar 2020 15:44:19 GMT
1355
1387
  ### Updates
1356
1388
 
1357
1389
  - Update to addon 1.14.1
1358
- - Fixed downloading of files using https/streaming to resolve when the filestream is closed instead of when the input stream is exhausted.
1390
+ - Fixed downloading of files using https/streaming to resolve when the filestream is closed instead of when the input stream is exhausted.
1359
1391
  - Add handling for invalid predecessor ids to IModelTransformer
1360
1392
  - Accomodate updated imodeljs-native ULAS functions
1361
1393
 
@@ -1370,7 +1402,7 @@ Wed, 12 Feb 2020 17:45:50 GMT
1370
1402
  ### Updates
1371
1403
 
1372
1404
  - Fix IGeometry roundtripping issue through ECSql. Fix insert/update binary properties for Element Aspect.
1373
- - Separated out routines to download and open briefcases.
1405
+ - Separated out routines to download and open briefcases.
1374
1406
  - bulk mode
1375
1407
  - Consolidated sign-in for integration tests
1376
1408
  - bulkmode
@@ -1381,7 +1413,7 @@ Wed, 12 Feb 2020 17:45:50 GMT
1381
1413
  - Add ViewDefinition.getAuxiliaryCoordinateSystemId and ViewDefinition.setAuxiliaryCoordinateSystemId methods
1382
1414
  - Add SpatialLocationModel.insert
1383
1415
  - Add optional isPlantProjection parameter to PhysicalModel.insert
1384
- - VSTS#256133: Fixed issue with reopening connections if the backend crashes. Fixes to integration tests.
1416
+ - VSTS#256133: Fixed issue with reopening connections if the backend crashes. Fixes to integration tests.
1385
1417
  - Better documentation of OidcDesktopClient
1386
1418
  - Fixed changeset perf test by using another iModel on Hub
1387
1419
  - Add ViewDetails to ViewDefinition.
@@ -1414,7 +1446,7 @@ Tue, 07 Jan 2020 19:44:01 GMT
1414
1446
  - Allow events to be sent from backend to frontend
1415
1447
  - Add tryGetInstance / tryGetInstanceProps methods to the Relationship class which return undefined rather than throwing an exception when a relationship is not found.
1416
1448
  - Fix webpack for ios test that were failing due to new dependencies
1417
- - VSTS#225894 - Allowed agents to bypass usage logging calls. These cause usage logging errors.
1449
+ - VSTS#225894 - Allowed agents to bypass usage logging calls. These cause usage logging errors.
1418
1450
  - Add tryGetElement / tryGetElementProps which return undefined rather than throwing an exception when an element is not found.
1419
1451
  - Add tryGetModel, tryGetModelProps, tryGetSubModel which return undefined instead of throwing exceptions when the model is not found.
1420
1452
 
@@ -1426,7 +1458,7 @@ Tue, 10 Dec 2019 18:08:56 GMT
1426
1458
  - Updated to addon 9.1.3
1427
1459
  - Added AliCloud tile cache service
1428
1460
  - Added framework to run imodeljs-backend test on ios using appcenter
1429
- - Setup OidcDesktopClient for Electron use cases.
1461
+ - Setup OidcDesktopClient for Electron use cases.
1430
1462
  - fix warnings from static analysis
1431
1463
  - Enabling testing code for updating LR aspects after fix in native side.
1432
1464
  - Addressing typo in a couple of members, making them match the schema properly.
@@ -1482,9 +1514,9 @@ Mon, 30 Sep 2019 22:28:48 GMT
1482
1514
  ### Updates
1483
1515
 
1484
1516
  - added support for blank IModelConnections
1485
- - Setup a way to supply authorization through the backend for frontend requests.
1486
- - Error log when downloading change sets should include iModelId for context.
1487
- - Fixed the iModelHub client to properly dispose a file handle after upload to the iModelHub.
1517
+ - Setup a way to supply authorization through the backend for frontend requests.
1518
+ - Error log when downloading change sets should include iModelId for context.
1519
+ - Fixed the iModelHub client to properly dispose a file handle after upload to the iModelHub.
1488
1520
  - Add IModelDb.Elements.hasSubModel
1489
1521
  - Make ExternalSourceAspect.checksum optional
1490
1522
  - Clear statement cache after schema import
@@ -1499,14 +1531,14 @@ Tue, 10 Sep 2019 12:09:49 GMT
1499
1531
 
1500
1532
  ### Updates
1501
1533
 
1502
- - Setup a way to supply authorization through the backend for frontend requests.
1503
- - Allow attaching change cache file before change summary extraction.
1504
- - Added change summary test, and improved doc a little.
1534
+ - Setup a way to supply authorization through the backend for frontend requests.
1535
+ - Allow attaching change cache file before change summary extraction.
1536
+ - Added change summary test, and improved doc a little.
1505
1537
  - Add minimum brep size option to IModelDb.exportGraphics
1506
1538
  - FunctionalSchema.importSchema is now deprecated.
1507
1539
  - Add support for GeometricModel.geometryGuid for detecting whether tiles for a model can be reused across versions
1508
1540
  - Added performance logging for tile upload
1509
- - IModelConnection.close() for read-only connections should not close the Db at the backend; Opening an iModel with SyncModel.PullAndPush() multiple times (without disposing it) must reuse the briefcase.
1541
+ - IModelConnection.close() for read-only connections should not close the Db at the backend; Opening an iModel with SyncModel.PullAndPush() multiple times (without disposing it) must reuse the briefcase.
1510
1542
  - Add method to create view with camera
1511
1543
  - Fixed misleading logging output in tile upload
1512
1544
 
@@ -1516,14 +1548,14 @@ Tue, 13 Aug 2019 20:25:53 GMT
1516
1548
  ### Updates
1517
1549
 
1518
1550
  - Allow custom tile cache services.
1519
- - Always acquire a briefcase when creating a new backend instance for PullAndPush workflows.
1520
- - Added Change Summary integration test, and fixed documentation.
1551
+ - Always acquire a briefcase when creating a new backend instance for PullAndPush workflows.
1552
+ - Added Change Summary integration test, and fixed documentation.
1521
1553
  - Trial code for tile upload errors
1522
1554
  - Fixed changeset performance tests
1523
1555
  - Tile upload logging.
1524
1556
  - Mark ExportGraphics API as public
1525
1557
  - Support for gzip compression of tiles
1526
- - Fixed issue with opening iModels with names that are invalid on Unix or Windows.
1558
+ - Fixed issue with opening iModels with names that are invalid on Unix or Windows.
1527
1559
  - Add IModelDb.isSnapshot
1528
1560
  - Tile upload error catching.
1529
1561
  - Azure tile upload logging
@@ -1535,7 +1567,7 @@ Wed, 24 Jul 2019 11:47:26 GMT
1535
1567
  ### Updates
1536
1568
 
1537
1569
  - Added option to restrict tile cache URLs by client IP address.
1538
- - Apply change sets at the backend in a non-blocking worker thread.
1570
+ - Apply change sets at the backend in a non-blocking worker thread.
1539
1571
  - Add ElementAspect handler methods
1540
1572
  - When deleting a parent element, make sure there are onDelete/onDeleted callbacks for child elements
1541
1573
  - Add support for linework to IModelDb.exportGraphics
@@ -1553,19 +1585,19 @@ Mon, 01 Jul 2019 19:04:29 GMT
1553
1585
 
1554
1586
  ### Updates
1555
1587
 
1556
- - Open fixes when briefcase requires merges.
1588
+ - Open fixes when briefcase requires merges.
1557
1589
  - Catch tile upload errors.
1558
- - Setting up briefcase is always from an older checkpoint.
1590
+ - Setting up briefcase is always from an older checkpoint.
1559
1591
  - Add materialId, subCategory to ExportGraphicsInfo
1560
- - Fix crash in getViewThumbnail for odd number of bytes
1592
+ - Fix crash in getViewThumbnail for odd number of bytes
1561
1593
  - Adding relationship class for GraphicalElement3dRepresentsElement.
1562
1594
  - Initial implementation of the LinearReferencing typescript domain
1563
1595
  - Adding domain classes for all relatinships in the LinearReferencing schema.
1564
1596
  - Exporting relationships module.
1565
- - Fixes to opening iModel-s ReadWrite from mutiple IModelConnection-s.
1566
- - Fixed issues with deleting briefcases if there were errors with preparing briefcases.
1597
+ - Fixes to opening iModel-s ReadWrite from mutiple IModelConnection-s.
1598
+ - Fixed issues with deleting briefcases if there were errors with preparing briefcases.
1567
1599
  - Add a new method `forceLoadSchemas` to `IModelJsNative.ECPresentationManager`.
1568
- - Introduced AsyncMutex - a utility to run async blocks of code in sequence.
1600
+ - Introduced AsyncMutex - a utility to run async blocks of code in sequence.
1569
1601
  - Properly document ModelSelector.models and CategorySelector.categories as Id64String arrays
1570
1602
  - Made `insertElement` not return Id64.invalid, throws error instead
1571
1603
  - Update to TypeScript 3.5
@@ -1576,7 +1608,7 @@ Mon, 03 Jun 2019 18:09:39 GMT
1576
1608
 
1577
1609
  ### Updates
1578
1610
 
1579
- - Migrated agent applications to the newer client
1611
+ - Migrated agent applications to the newer client
1580
1612
  - RPC system now accepts only basic values (primitives, "interface" objects, and binary).
1581
1613
  - Switched from iModelHub Project API to Context API
1582
1614
  - Fix bug in IModelDb.createSnapshotFromSeed
@@ -1624,12 +1656,12 @@ Mon, 13 May 2019 15:52:05 GMT
1624
1656
  - Cleanup old imodelbank references
1625
1657
  - Add InformationRecordModel.insert, GroupModel.insert
1626
1658
  - Introduce LoggerCategory enum to advertise logger categories used by this package.
1627
- - Limited maximum cache size of the backend PromiseMemoizer.
1659
+ - Limited maximum cache size of the backend PromiseMemoizer.
1628
1660
  - Missing dependency on node-report
1629
- - Fixed memoization problem that caused an endless stream of 404 NotFound errors.
1661
+ - Fixed memoization problem that caused an endless stream of 404 NotFound errors.
1630
1662
  - Reinstated old version of OidcAgentClient
1631
- - Unauthorized open requests should cause a more obvious error.
1632
- - Improved performance logging, especially of IModelDb open operations; ChangeSets are merged one-by-one to prevent hogging the event loop.
1663
+ - Unauthorized open requests should cause a more obvious error.
1664
+ - Improved performance logging, especially of IModelDb open operations; ChangeSets are merged one-by-one to prevent hogging the event loop.
1633
1665
  - Memoization fix when opening iModels in shared, read-only mode .
1634
1666
  - Fixed setup of application version.
1635
1667
  - Updated Element CRUD perf tests
@@ -1639,7 +1671,7 @@ Mon, 13 May 2019 15:52:05 GMT
1639
1671
  - Remove ElementPropertyFormatter, IModelDb.getElementPropertiesForDisplay (use presentation rules instead)
1640
1672
  - Remove StandaloneIModelRpcImpl
1641
1673
  - Fix for Render Gradient.Symb test
1642
- - Setup a generic context for tracking client requests, and made various related enhancements to logging, usage tracking and authorization.
1674
+ - Setup a generic context for tracking client requests, and made various related enhancements to logging, usage tracking and authorization.
1643
1675
  - Add IModelDb.createSnapshot/openSnapshot/closeSnapshot, deprecate IModelDb.createStandalone/openStandalone/closeStandalone
1644
1676
  - Moved IModelJsExpressServer class into a new package (@itwin/express-server).
1645
1677
  - Simplified tile caching IModelHost config and removed dev flags. Allow
@@ -1666,7 +1698,7 @@ Wed, 06 Mar 2019 15:41:22 GMT
1666
1698
  - Changes package.json to include api-extractor and adds api-extractor.json
1667
1699
  - Use new buildIModelJsBuild script
1668
1700
  - AxisAlignedBox and ElementAlignedBox are now typed to Range3d rather than classes
1669
- - Moved AzureFileHandler, IOSAzureFileHandler, UrlFileHandler and the iModelHub tests to the imodeljs-clients-backend package. This removes the dependency of imodeljs-clients on the "fs" module, and turns it into a browser only package.
1701
+ - Moved AzureFileHandler, IOSAzureFileHandler, UrlFileHandler and the iModelHub tests to the imodeljs-clients-backend package. This removes the dependency of imodeljs-clients on the "fs" module, and turns it into a browser only package.
1670
1702
  - Clone methods are no longer generic
1671
1703
  - Remove unneeded typedoc plugin dependency
1672
1704
  - Added spatial <-> cartographic methods that check/use the geographic coordinate system before using ecef location.
@@ -1711,8 +1743,8 @@ Mon, 14 Jan 2019 23:09:10 GMT
1711
1743
 
1712
1744
  ### Updates
1713
1745
 
1714
- - More logging of HTTP requests, and enabled use of fiddler for backend diagnostics.
1715
- - Removed IModelDb's cache of accessToken. For long running operations like AutoPush, the user must explicitly supply an IAccessTokenManager to keep the token current.
1746
+ - More logging of HTTP requests, and enabled use of fiddler for backend diagnostics.
1747
+ - Removed IModelDb's cache of accessToken. For long running operations like AutoPush, the user must explicitly supply an IAccessTokenManager to keep the token current.
1716
1748
  - Renamed RequestProxy->RequestHost. Allowed applications to configure proxy server with HTTPS_PROXY env.
1717
1749
  - Add backend TextureAPI and accompanying test
1718
1750
 
@@ -1817,7 +1849,7 @@ Mon, 03 Dec 2018 18:52:58 GMT
1817
1849
 
1818
1850
  ### Updates
1819
1851
 
1820
- - More information logged from BriefcaseManager.\nFixed deletion/cleanup of invalid briefcases.\nAdded OIDC support for simpleviewtest application.
1852
+ - More information logged from BriefcaseManager.\nFixed deletion/cleanup of invalid briefcases.\nAdded OIDC support for simpleviewtest application.
1821
1853
  - Add ElementRefersToElements.insert
1822
1854
  - Fixed front end integration tests.
1823
1855
  - Document the intended purpose of IModelJsExpressServer within a deployment environment.
@@ -1886,11 +1918,11 @@ Thu, 08 Nov 2018 17:59:20 GMT
1886
1918
 
1887
1919
  - Fix JSON representation of DisplayStyle.
1888
1920
  - Add IModelImporter as a base class for utility methods needed by all importers
1889
- - Removed assertion when deleting a memoized open call.
1921
+ - Removed assertion when deleting a memoized open call.
1890
1922
  - Add more methods to IModelImporter
1891
1923
  - Fix snapping test
1892
1924
  - OIDC related enhancments (WIP).
1893
- - Re-enabled several backend integration tests.
1925
+ - Re-enabled several backend integration tests.
1894
1926
  - Refactor analysis-importer to use IModelImporter
1895
1927
  - Updated to TypeScript 3.1
1896
1928
 
@@ -34,7 +34,7 @@ export declare class TileStorage {
34
34
  getCachedTiles(iModelId: string): Promise<{
35
35
  treeId: string;
36
36
  contentId: string;
37
- guid?: string;
37
+ guid: string;
38
38
  }[]>;
39
39
  /**
40
40
  * Returns a boolean indicating wh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AAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAA,oCAAsB,EAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3G,CAAC;IAEO,YAAY,CAAC,OAAe,EAAE,GAAY;QAChD,qBAAM,CAAC,YAAY,CACjB,6CAAqB,CAAC,iBAAiB,EACvC,GAAG,EACH,CAAC,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,CAAC,qBAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,OAAO,kBAAkB,EAAE,EAAE,GAAG,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CACnI,CAAC;IACJ,CAAC;CACF;AAjHD,kCAiHC","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\nimport { gunzip, gzip } from \"zlib\";\r\nimport { promisify } from \"util\";\r\nimport { Metadata, ServerStorage, TransferConfig } from \"@itwin/object-storage-core\";\r\nimport { getTileObjectReference } from \"@itwin/core-common\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { IModelHost } from \"./IModelHost\";\r\n\r\n/**\r\n * Facilitates interaction with cloud tile cache.\r\n * @beta\r\n */\r\nexport class TileStorage {\r\n /**\r\n * Allows using the underlying `ServerStorage` API directly.\r\n * @see https://github.com/iTwin/object-storage/\r\n */\r\n public readonly storage: ServerStorage;\r\n\r\n public constructor(storage: ServerStorage) {\r\n this.storage = storage;\r\n }\r\n\r\n private _initializedIModels: Set<string> = new Set();\r\n\r\n /**\r\n * Ensures any required cloud storage resources for a specific iModel are ready to use.\r\n */\r\n public async initialize(iModelId: string): Promise<void> {\r\n if (this._initializedIModels.has(iModelId))\r\n return;\r\n if (!(await this.storage.baseDirectoryExists({ baseDirectory: iModelId }))) {\r\n await this.storage.createBaseDirectory({ baseDirectory: iModelId });\r\n }\r\n this._initializedIModels.add(iModelId);\r\n }\r\n\r\n /**\r\n * Returns config that can be used by frontends to download tiles\r\n * @see [TileStorage]($frontend)\r\n */\r\n public async getDownloadConfig(iModelId: string, expiresInSeconds?: number): Promise<TransferConfig> {\r\n try {\r\n return await this.storage.getDownloadConfig({ baseDirectory: iModelId }, expiresInSeconds);\r\n } catch (err) {\r\n this.logException(\"Failed to get download config\", err);\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Uploads a tile to the cloud cache.\r\n */\r\n public async uploadTile(iModelId: string, changesetId: string, treeId: string, contentId: string, content: Uint8Array, guid?: string, metadata?: Metadata): Promise<void> {\r\n try {\r\n await this.storage.upload(\r\n getTileObjectReference(iModelId, changesetId, treeId, contentId, guid),\r\n Buffer.from(IModelHost.compressCachedTiles ? await promisify(gzip)(content.buffer) : content.buffer),\r\n metadata,\r\n IModelHost.compressCachedTiles ? { contentEncoding: \"gzip\" } : undefined,\r\n );\r\n } catch (err) {\r\n this.logException(\"Failed to upload tile\", err);\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Downloads a tile from the cloud cache.\r\n */\r\n public async downloadTile(iModelId: string, changesetId: string, treeId: string, contentId: string, guid?: string): Promise<Uint8Array> {\r\n try {\r\n const buffer = await this.storage.download(\r\n getTileObjectReference(iModelId, changesetId, treeId, contentId, guid),\r\n \"buffer\"\r\n );\r\n return IModelHost.compressCachedTiles ? await promisify(gunzip)(buffer) : buffer;\r\n } catch (err) {\r\n this.logException(\"Failed to download tile\", err);\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a list of all tiles that are found in the cloud cache.\r\n */\r\n public async getCachedTiles(iModelId: string): Promise<{ treeId: string, contentId: string, guid?: string }[]> {\r\n return (await this.storage.listObjects({ baseDirectory: iModelId }))\r\n .map((objectReference) => ({\r\n parts: objectReference.relativeDirectory?.split(\"/\") ?? [\"\"],\r\n objectName: objectReference.objectName,\r\n }))\r\n .filter(({ parts, objectName }) => {\r\n if (parts[0] !== \"tiles\")\r\n return false;\r\n if (parts.length !== 3) {\r\n Logger.logWarning(BackendLoggerCategory.IModelTileStorage, \"Malformed tile id found in tile cache: {tileId}\", { tileId: [...parts, objectName].join(\"/\") });\r\n return false;\r\n }\r\n return true;\r\n }).map(({ parts, objectName }) => {\r\n // relativeDirectory = tiles/<treeId>/<guid>\r\n // objectName = <contentId>\r\n return {\r\n treeId: parts[1],\r\n contentId: objectName,\r\n guid: parts[2],\r\n };\r\n });\r\n }\r\n\r\n /**\r\n * Returns a boolean indicating whether a tile exists in the cloud cache\r\n */\r\n public async isTileCached(iModelId: string, changesetId: string, treeId: string, contentId: string, guid?: string): Promise<boolean> {\r\n return this.storage.objectExists(getTileObjectReference(iModelId, changesetId, treeId, contentId, guid));\r\n }\r\n\r\n private logException(message: string, err: unknown): void {\r\n Logger.logException(\r\n BackendLoggerCategory.IModelTileStorage,\r\n err,\r\n (category, msg, errorMetadata) => Logger.logError(category, `${message}: {errorMessage}`, { ...errorMetadata, errorMessage: msg })\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TileStorage.js","sourceRoot":"","sources":["../../src/TileStorage.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAAoC;AACpC,+BAAiC;AAEjC,oDAA4D;AAC5D,sDAA6C;AAC7C,mEAAgE;AAChE,6CAA0C;AAE1C;;;GAGG;AACH,MAAa,WAAW;IAOtB,YAAmB,OAAsB;QAIjC,wBAAmB,GAAgB,IAAI,GAAG,EAAE,CAAC;QAHnD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAID;;OAEG;IACI,KAAK,CAAC,UAAU,CAAC,QAAgB;QACtC,IAAI,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxC,OAAO;QACT,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,C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AAG,KAAK,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC5J,OAAO,KAAK,CAAC;aACd;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;YAC/B,4CAA4C;YAC5C,2BAA2B;YAC3B,OAAO;gBACL,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;gBAChB,SAAS,EAAE,UAAU;gBACrB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;aACf,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,WAAmB,EAAE,MAAc,EAAE,SAAiB,EAAE,IAAa;QAC/G,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAA,oCAAsB,EAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3G,CAAC;IAEO,YAAY,CAAC,OAAe,EAAE,GAAY;QAChD,qBAAM,CAAC,YAAY,CACjB,6CAAqB,CAAC,iBAAiB,EACvC,GAAG,EACH,CAAC,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,CAAC,qBAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,OAAO,kBAAkB,EAAE,EAAE,GAAG,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CACnI,CAAC;IACJ,CAAC;CACF;AAjHD,kCAiHC","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\nimport { gunzip, gzip } from \"zlib\";\r\nimport { promisify } from \"util\";\r\nimport { Metadata, ServerStorage, TransferConfig } from \"@itwin/object-storage-core\";\r\nimport { getTileObjectReference } from \"@itwin/core-common\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { IModelHost } from \"./IModelHost\";\r\n\r\n/**\r\n * Facilitates interaction with cloud tile cache.\r\n * @beta\r\n */\r\nexport class TileStorage {\r\n /**\r\n * Allows using the underlying `ServerStorage` API directly.\r\n * @see https://github.com/iTwin/object-storage/\r\n */\r\n public readonly storage: ServerStorage;\r\n\r\n public constructor(storage: ServerStorage) {\r\n this.storage = storage;\r\n }\r\n\r\n private _initializedIModels: Set<string> = new Set();\r\n\r\n /**\r\n * Ensures any required cloud storage resources for a specific iModel are ready to use.\r\n */\r\n public async initialize(iModelId: string): Promise<void> {\r\n if (this._initializedIModels.has(iModelId))\r\n return;\r\n if (!(await this.storage.baseDirectoryExists({ baseDirectory: iModelId }))) {\r\n await this.storage.createBaseDirectory({ baseDirectory: iModelId });\r\n }\r\n this._initializedIModels.add(iModelId);\r\n }\r\n\r\n /**\r\n * Returns config that can be used by frontends to download tiles\r\n * @see [TileStorage]($frontend)\r\n */\r\n public async getDownloadConfig(iModelId: string, expiresInSeconds?: number): Promise<TransferConfig> {\r\n try {\r\n return await this.storage.getDownloadConfig({ baseDirectory: iModelId }, expiresInSeconds);\r\n } catch (err) {\r\n this.logException(\"Failed to get download config\", err);\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Uploads a tile to the cloud cache.\r\n */\r\n public async uploadTile(iModelId: string, changesetId: string, treeId: string, contentId: string, content: Uint8Array, guid?: string, metadata?: Metadata): Promise<void> {\r\n try {\r\n await this.storage.upload(\r\n getTileObjectReference(iModelId, changesetId, treeId, contentId, guid),\r\n Buffer.from(IModelHost.compressCachedTiles ? await promisify(gzip)(content.buffer) : content.buffer),\r\n metadata,\r\n IModelHost.compressCachedTiles ? { contentEncoding: \"gzip\" } : undefined,\r\n );\r\n } catch (err) {\r\n this.logException(\"Failed to upload tile\", err);\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Downloads a tile from the cloud cache.\r\n */\r\n public async downloadTile(iModelId: string, changesetId: string, treeId: string, contentId: string, guid?: string): Promise<Uint8Array> {\r\n try {\r\n const buffer = await this.storage.download(\r\n getTileObjectReference(iModelId, changesetId, treeId, contentId, guid),\r\n \"buffer\"\r\n );\r\n return IModelHost.compressCachedTiles ? await promisify(gunzip)(buffer) : buffer;\r\n } catch (err) {\r\n this.logException(\"Failed to download tile\", err);\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a list of all tiles that are found in the cloud cache.\r\n */\r\n public async getCachedTiles(iModelId: string): Promise<{ treeId: string, contentId: string, guid: string }[]> {\r\n return (await this.storage.listObjects({ baseDirectory: iModelId }))\r\n .map((objectReference) => ({\r\n parts: objectReference.relativeDirectory?.split(\"/\") ?? [\"\"],\r\n objectName: objectReference.objectName,\r\n }))\r\n .filter(({ parts, objectName }) => {\r\n if (parts[0] !== \"tiles\")\r\n return false;\r\n if (parts.length !== 3) {\r\n Logger.logWarning(BackendLoggerCategory.IModelTileStorage, \"Malformed tile id found in tile cache: {tileId}\", { tileId: [...parts, objectName].join(\"/\") });\r\n return false;\r\n }\r\n return true;\r\n }).map(({ parts, objectName }) => {\r\n // relativeDirectory = tiles/<treeId>/<guid>\r\n // objectName = <contentId>\r\n return {\r\n treeId: parts[1],\r\n contentId: objectName,\r\n guid: parts[2],\r\n };\r\n });\r\n }\r\n\r\n /**\r\n * Returns a boolean indicating whether a tile exists in the cloud cache\r\n */\r\n public async isTileCached(iModelId: string, changesetId: string, treeId: string, contentId: string, guid?: string): Promise<boolean> {\r\n return this.storage.objectExists(getTileObjectReference(iModelId, changesetId, treeId, contentId, guid));\r\n }\r\n\r\n private logException(message: string, err: unknown): void {\r\n Logger.logException(\r\n BackendLoggerCategory.IModelTileStorage,\r\n err,\r\n (category, msg, errorMetadata) => Logger.logError(category, `${message}: {errorMessage}`, { ...errorMetadata, errorMessage: msg })\r\n );\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-backend",
3
- "version": "4.0.0-dev.70",
3
+ "version": "4.0.0-dev.72",
4
4
  "description": "iTwin.js backend components",
5
5
  "main": "lib/cjs/core-backend.js",
6
6
  "typings": "lib/cjs/core-backend",
@@ -25,9 +25,9 @@
25
25
  "url": "http://www.bentley.com"
26
26
  },
27
27
  "peerDependencies": {
28
- "@itwin/core-bentley": "^4.0.0-dev.70",
29
- "@itwin/core-common": "^4.0.0-dev.70",
30
- "@itwin/core-geometry": "^4.0.0-dev.70",
28
+ "@itwin/core-bentley": "^4.0.0-dev.72",
29
+ "@itwin/core-common": "^4.0.0-dev.72",
30
+ "@itwin/core-geometry": "^4.0.0-dev.72",
31
31
  "@opentelemetry/api": "^1.0.4"
32
32
  },
33
33
  "peerDependenciesMeta": {
@@ -40,12 +40,12 @@
40
40
  "NOTE: All tools used by scripts in this package must be listed as devDependencies"
41
41
  ],
42
42
  "devDependencies": {
43
- "@itwin/build-tools": "4.0.0-dev.70",
44
- "@itwin/core-bentley": "4.0.0-dev.70",
45
- "@itwin/core-common": "4.0.0-dev.70",
46
- "@itwin/core-geometry": "4.0.0-dev.70",
47
- "@itwin/core-webpack-tools": "4.0.0-dev.70",
48
- "@itwin/eslint-plugin": "^4.0.0-dev.32",
43
+ "@itwin/build-tools": "4.0.0-dev.72",
44
+ "@itwin/core-bentley": "4.0.0-dev.72",
45
+ "@itwin/core-common": "4.0.0-dev.72",
46
+ "@itwin/core-geometry": "4.0.0-dev.72",
47
+ "@itwin/core-webpack-tools": "4.0.0-dev.72",
48
+ "@itwin/eslint-plugin": "^4.0.0-dev.33",
49
49
  "@opentelemetry/api": "1.0.4",
50
50
  "@types/chai": "4.3.1",
51
51
  "@types/chai-as-promised": "^7",
@@ -61,7 +61,7 @@
61
61
  "cpx2": "^3.0.0",
62
62
  "dotenv": "^10.0.0",
63
63
  "dotenv-expand": "^5.1.0",
64
- "eslint": "^7.11.0",
64
+ "eslint": "^8.36.0",
65
65
  "fs-extra": "^8.1.0",
66
66
  "internal-tools": "3.0.0-dev.69",
67
67
  "mocha": "^10.0.0",
@@ -79,7 +79,7 @@
79
79
  "@itwin/object-storage-azure": "^1.5.0",
80
80
  "@itwin/cloud-agnostic-core": "^1.5.0",
81
81
  "@itwin/object-storage-core": "^1.5.0",
82
- "@itwin/core-telemetry": "4.0.0-dev.70",
82
+ "@itwin/core-telemetry": "4.0.0-dev.72",
83
83
  "form-data": "^2.3.2",
84
84
  "fs-extra": "^8.1.0",
85
85
  "inversify": "~5.0.1",