Copyright © Bentley Systems, Incorporated. All rights reserved.
imodel-query-agent is an example of an agent that illustrates use of the iModel.js API to listen and query changes made to iModels on the iModelHub. A separate optional imodel-changeset-test-utility can be used to generate sample change sets that can then be consumed by this sample.
More specifically, this sample application demonstrates use of iModel.js API to:
* Listen to 'Change Sets' posted to the iModels on the iModelHub.
* Listen to 'Named Versions' created for iModels on the iModelHub.
* Query and download these Change Sets from the iModelHub.
* Parse the Change Sets to construct a 'Change Summary' of useful information contained in them.
* Iterate and query the information contained in the Change Summary.
Watch the console for various messages that show the progress:
* Register event handlers that listen to Change Sets being posted to the iModelHub.
* Register event handlers that listen to Named Versions created on the iModelHub.
* Receive notification of a new Change Set posted to the iModelHub.
* Receive notification of a new Named Version created on the iModelHub.
* Extract Change Summary information from the Change Set.
* Dump the contents of the Change Summary as a JSON file to disk.
See http://imodeljs.org for comprehensive documentation on the iModel.js API and the various constructs used in this sample.
The authorization method of agent clients has been changed in versions >=0.192.0. Therefore all registrations using agent clients created before 0.192.0 have been invalidated. To continue using your app with versions >=0.192.0 please create a new agent registration here. (i.e. You will need a client_id that starts with service-xxxxxx if using iModel.js versions >=0.192.0.) The new registration process is easy, fully automated, and can be completed in minutes.
-
Follow the Agent Development Setup section under Sample Agent Apps to configure, install dependencies, build, and run the app.
-
(Optional) Follow the Development Setup process to setup the imodel-changeset-test-utility. The utility can be used to generate and push sample change sets to the iModelHub that can then be consumed by this sample.
-
Start this sample application with
npm start
. -
(Optional) Immediately start the imodel-changeset-test-utility to generate and push change sets by following the procedure documented in its README.
The sample includes some tests to validate its behavior - these are useful for internal testing:
- Use
npm test
to run unit tests - Use
npm run test:integration
to run integration tests
To debug the Query Agent Code click the launch configuration Attach to Main.js
in the debug menu for VS code. Then in your terminal run npm run start:debug
and wait for breakpoints to be hit.