Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide hook after transformer initializes to allow consumers to run some code. #180

Closed
nick4598 opened this issue May 13, 2024 · 2 comments · Fixed by #190
Closed

Provide hook after transformer initializes to allow consumers to run some code. #180

nick4598 opened this issue May 13, 2024 · 2 comments · Fixed by #190

Comments

@nick4598
Copy link
Collaborator

nick4598 commented May 13, 2024

Context

NOTE: Not urgent or blocking! There are already currently working workarounds in SVCs side for this.
SVCs team has a function manualInitialize which is used mainly for: this._startChangesetIndex = this.synchronizationVersion.index + 1;.

We should support SVCs team desire to determine the startChangesetIndex so that they do not have to have a manualInitialize which has to set a private property _isSynchronization on the core transformer.

Potential Options

  • Provide a hook onTransformerInitialized which lets consumers run code right after the transformer is initialized and before it starts processing changes. Consumers would pass this function as part of the transformer options.
  • Adding method to transformer to get the startchangesetindex?

Maybe on red arrow could add?
image
image
Or somewhere in this function above

Concerns

I raised a concern on the below PR that I think could be relevant.
#172

One other concern I have is, does the transformation services team ever setup the exporter manually before you call the transformer? Currently you'll need to add your custom changes before you call IModelTransformer.initialize(), which I personally ran into some trouble when trying to allow myself to do that in the tests (can look at timelinetestutil to see what changes I had to make to support that)

@JulijaRamoskiene
Copy link
Contributor

JulijaRamoskiene commented May 14, 2024

Rplied to your question about exporter: #172 (comment)

To answer your question about Exporter, yes, we do set up exporter manually.
We have our custom Exporter: https://dev.azure.com/bentleycs/iModelTechnologies/_git/imodel-transformations?path=/packages/imodel-transformations-local/src/Exporter.ts
Which is initialized and passed to transformer here: https://dev.azure.com/bentleycs/iModelTechnologies/_git/imodel-transformations?path=/packages/imodel-transformations-local/src/transformers/TransformerFactory.ts

@nick4598
Copy link
Collaborator Author

PR linked will be to untangle initializing and calling processChanges, so consumers could run anything they wanted in between calling initialize() and process() on the transformer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants