kubeshop / monokle-core

Monokle validation engine, CLI and shared UI components
MIT License
18 stars 3 forks source link

feat(synchronizer): add synchronizer query to fetch all validation needed data #599

Closed f1ames closed 9 months ago

f1ames commented 9 months ago

This PR is a part of https://github.com/kubeshop/vscode-monokle/issues/93.

The main goal is to allow fetching all data required for integrations at once and to allow fetched data to be used in synchronous manner.

I kept previous synchronizer without changes (but deprecated it) since it is used by multiple integrations. And introduced ProjectSynchronizer since the way it works is quite different from the previous one. Putting everything in the same class would be a mess.

The main idea is that it exposes synchronize method (the same as previous one) which refetches data whenever called (so this is integrator responsibility to know when to refetch). Entire response is cached and then used when get* methods are used. This way fetching is decoupled from getting/using data.

Changes

Fixes

Checklist

changeset-bot[bot] commented 9 months ago

🦋 Changeset detected

Latest commit: be5334a5dfbb9b9cedbdb6870b72adc8224d619a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | --------------------- | ----- | | @monokle/synchronizer | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

WitoDelnat commented 9 months ago

Tests are commented, maybe just remove them since they are in git anyway? Or maybe you still wanted to do them before finalising this PR?

f1ames commented 9 months ago

Tests are commented, maybe just remove them since they are in git anyway? Or maybe you still wanted to do them before finalising this PR?

Yes, I wanted to at least add one test which will cover synchronization logic, that's why I left it like that. I will clean it up when adding it 👍