-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Framework] Improvements to delete netities on real time (#571)
# Description What - Improvements to delete entities on real time, denying inefficient cases Why - previous changes might resulted a case of trying to calculate full jq mapping of entities that wouldn't being registered eventually, and also performing lots of api requests to port api. How - using multiple rules search api when checking entities to delete and calculating only relevant for deletion jq fields ## Type of change Please leave one option from the following and delete the rest: - [X] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] New Integration (non-breaking change which adds a new integration) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Non-breaking change (fix of existing functionality that will not change current behavior) - [ ] Documentation (added/updated documentation) ## Screenshots Include screenshots from your environment showing how the resources of the integration will look. ## API Documentation Provide links to the API documentation used for this integration.
- Loading branch information
Showing
7 changed files
with
109 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,33 @@ | ||
from typing import TypedDict, Any, AsyncIterator, Callable, Awaitable | ||
from typing import TypedDict, Any, AsyncIterator, Callable, Awaitable, NamedTuple | ||
|
||
from port_ocean.core.models import Entity | ||
|
||
|
||
RawEntity = dict[Any, Any] | ||
RAW_ITEM = dict[Any, Any] | ||
RAW_RESULT = list[RAW_ITEM] | ||
ASYNC_GENERATOR_RESYNC_TYPE = AsyncIterator[RAW_RESULT] | ||
RESYNC_RESULT = list[RAW_ITEM | ASYNC_GENERATOR_RESYNC_TYPE] | ||
|
||
LISTENER_RESULT = Awaitable[RAW_RESULT] | ASYNC_GENERATOR_RESYNC_TYPE | ||
RESYNC_EVENT_LISTENER = Callable[[str], LISTENER_RESULT] | ||
START_EVENT_LISTENER = Callable[[], Awaitable[None]] | ||
|
||
|
||
class RawEntityDiff(TypedDict): | ||
before: list[RawEntity] | ||
after: list[RawEntity] | ||
before: list[RAW_ITEM] | ||
after: list[RAW_ITEM] | ||
|
||
|
||
class EntityDiff(TypedDict): | ||
before: list[Entity] | ||
after: list[Entity] | ||
|
||
|
||
class EntitySelectorDiff(TypedDict): | ||
class EntitySelectorDiff(NamedTuple): | ||
passed: list[Entity] | ||
failed: list[Entity] | ||
|
||
|
||
RAW_ITEM = dict[Any, Any] | ||
RAW_RESULT = list[RAW_ITEM] | ||
ASYNC_GENERATOR_RESYNC_TYPE = AsyncIterator[RAW_RESULT] | ||
RESYNC_RESULT = list[RAW_ITEM | ASYNC_GENERATOR_RESYNC_TYPE] | ||
|
||
LISTENER_RESULT = Awaitable[RAW_RESULT] | ASYNC_GENERATOR_RESYNC_TYPE | ||
RESYNC_EVENT_LISTENER = Callable[[str], LISTENER_RESULT] | ||
START_EVENT_LISTENER = Callable[[], Awaitable[None]] | ||
|
||
|
||
class IntegrationEventsCallbacks(TypedDict): | ||
start: list[START_EVENT_LISTENER] | ||
resync: dict[str | None, list[RESYNC_EVENT_LISTENER]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters