port-ocean 0.5.13__tar.gz → 0.5.14__tar.gz
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.
Potentially problematic release.
This version of port-ocean might be problematic. Click here for more details.
- {port_ocean-0.5.13 → port_ocean-0.5.14}/PKG-INFO +3 -3
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/mixins/entities.py +25 -19
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entity_processor/base.py +3 -3
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entity_processor/jq_entity_processor.py +3 -3
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/integrations/mixins/sync_raw.py +58 -44
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/ocean_types.py +12 -15
- {port_ocean-0.5.13 → port_ocean-0.5.14}/pyproject.toml +4 -4
- {port_ocean-0.5.13 → port_ocean-0.5.14}/LICENSE.md +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/README.md +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/bootstrap.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cli.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/defaults/__init___.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/defaults/clean.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/defaults/dock.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/defaults/group.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/list_integrations.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/main.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/new.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/pull.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/sail.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/commands/version.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/cookiecutter.json +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/extensions.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/hooks/post_gen_project.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.dockerignore +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.gitignore +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/resources/.gitignore +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/spec.yaml +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/CHANGELOG.md +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/Dockerfile +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/Makefile +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/README.md +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/changelog/.gitignore +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/config.yaml +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/debug.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/main.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/poetry.toml +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/pyproject.toml +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/sonar-project.properties +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/tests/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/utils.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/authentication.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/client.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/mixins/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/mixins/blueprints.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/mixins/integrations.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/mixins/migrations.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/retry_transport.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/types.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/clients/port/utils.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/config/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/config/base.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/config/dynamic.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/config/settings.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/consumers/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/consumers/kafka_consumer.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/context/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/context/event.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/context/ocean.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/context/resource.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/defaults/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/defaults/clean.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/defaults/common.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/defaults/initialize.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/event_listener/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/event_listener/base.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/event_listener/factory.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/event_listener/http.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/event_listener/kafka.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/event_listener/once.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/event_listener/polling.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/base.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entities_state_applier/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entities_state_applier/base.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entities_state_applier/port/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entities_state_applier/port/applier.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entities_state_applier/port/get_related_entities.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entities_state_applier/port/order_by_entities_dependencies.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entity_processor/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/port_app_config/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/port_app_config/api.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/port_app_config/base.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/port_app_config/models.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/integrations/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/integrations/base.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/integrations/mixins/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/integrations/mixins/events.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/integrations/mixins/handler.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/integrations/mixins/sync.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/integrations/mixins/utils.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/models.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/utils.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/exceptions/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/exceptions/api.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/exceptions/base.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/exceptions/clients.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/exceptions/context.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/exceptions/core.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/exceptions/port_defaults.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/exceptions/utils.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/helpers/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/helpers/async_client.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/helpers/retry.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/log/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/log/handlers.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/log/logger_setup.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/log/sensetive.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/middlewares.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/ocean.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/py.typed +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/run.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/sonar-project.properties +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/utils/__init__.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/utils/async_http.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/utils/async_iterators.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/utils/cache.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/utils/misc.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/utils/repeat.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/utils/signal.py +0 -0
- {port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: port-ocean
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.14
|
|
4
4
|
Summary: Port Ocean is a CLI tool for managing your Port projects.
|
|
5
5
|
Home-page: https://app.getport.io
|
|
6
6
|
Keywords: ocean,port-ocean,port
|
|
@@ -25,7 +25,7 @@ Requires-Dist: aiostream (>=0.5.2,<0.6.0)
|
|
|
25
25
|
Requires-Dist: click (>=8.1.3,<9.0.0) ; extra == "cli"
|
|
26
26
|
Requires-Dist: confluent-kafka (>=2.1.1,<3.0.0)
|
|
27
27
|
Requires-Dist: cookiecutter (>=2.1.1,<3.0.0) ; extra == "cli"
|
|
28
|
-
Requires-Dist: fastapi (>=0.100,<0.
|
|
28
|
+
Requires-Dist: fastapi (>=0.100,<0.111)
|
|
29
29
|
Requires-Dist: httpx (>=0.24.1,<0.28.0)
|
|
30
30
|
Requires-Dist: jinja2-time (>=0.2.0,<0.3.0) ; extra == "cli"
|
|
31
31
|
Requires-Dist: loguru (>=0.7.0,<0.8.0)
|
|
@@ -37,7 +37,7 @@ Requires-Dist: pyyaml (>=6.0,<7.0)
|
|
|
37
37
|
Requires-Dist: rich (>=13.4.1,<14.0.0) ; extra == "cli"
|
|
38
38
|
Requires-Dist: six (>=1.16.0,<2.0.0)
|
|
39
39
|
Requires-Dist: tomli (>=2.0.1,<3.0.0)
|
|
40
|
-
Requires-Dist: urllib3 (>=1.26.16,<
|
|
40
|
+
Requires-Dist: urllib3 (>=1.26.16,<3.0.0)
|
|
41
41
|
Requires-Dist: uvicorn (>=0.22,<0.30)
|
|
42
42
|
Requires-Dist: werkzeug (>=2.3.4,<4.0.0)
|
|
43
43
|
Project-URL: Repository, https://github.com/port-labs/Port-Ocean
|
|
@@ -173,27 +173,33 @@ class EntityClientMixin:
|
|
|
173
173
|
handle_status_code(response)
|
|
174
174
|
return [Entity.parse_obj(result) for result in response.json()["entities"]]
|
|
175
175
|
|
|
176
|
-
async def
|
|
177
|
-
self,
|
|
178
|
-
) ->
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
async def search_batch_entities(
|
|
177
|
+
self, user_agent_type: UserAgentType, entities_to_search: list[Entity]
|
|
178
|
+
) -> list[Entity]:
|
|
179
|
+
search_rules = []
|
|
180
|
+
for entity in entities_to_search:
|
|
181
|
+
search_rules.append(
|
|
182
|
+
{
|
|
183
|
+
"combinator": "and",
|
|
184
|
+
"rules": [
|
|
185
|
+
{
|
|
186
|
+
"property": "$identifier",
|
|
187
|
+
"operator": "=",
|
|
188
|
+
"value": entity.identifier,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"property": "$blueprint",
|
|
192
|
+
"operator": "=",
|
|
193
|
+
"value": entity.blueprint,
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
return await self.search_entities(
|
|
181
200
|
user_agent_type,
|
|
182
201
|
{
|
|
183
202
|
"combinator": "and",
|
|
184
|
-
"rules": [
|
|
185
|
-
{
|
|
186
|
-
"property": "$identifier",
|
|
187
|
-
"operator": "contains",
|
|
188
|
-
"value": entity.identifier,
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
"property": "$blueprint",
|
|
192
|
-
"operator": "contains",
|
|
193
|
-
"value": entity.blueprint,
|
|
194
|
-
},
|
|
195
|
-
],
|
|
203
|
+
"rules": [{"combinator": "or", "rules": search_rules}],
|
|
196
204
|
},
|
|
197
205
|
)
|
|
198
|
-
|
|
199
|
-
return len(found_entities) > 0
|
|
@@ -7,7 +7,7 @@ from port_ocean.core.handlers.base import BaseHandler
|
|
|
7
7
|
from port_ocean.core.handlers.port_app_config.models import ResourceConfig
|
|
8
8
|
from port_ocean.core.models import Entity
|
|
9
9
|
from port_ocean.core.ocean_types import (
|
|
10
|
-
|
|
10
|
+
RAW_ITEM,
|
|
11
11
|
EntitySelectorDiff,
|
|
12
12
|
)
|
|
13
13
|
|
|
@@ -38,7 +38,7 @@ class BaseEntityProcessor(BaseHandler):
|
|
|
38
38
|
async def _parse_items(
|
|
39
39
|
self,
|
|
40
40
|
mapping: ResourceConfig,
|
|
41
|
-
raw_data: list[
|
|
41
|
+
raw_data: list[RAW_ITEM],
|
|
42
42
|
parse_all: bool = False,
|
|
43
43
|
) -> EntitySelectorDiff:
|
|
44
44
|
pass
|
|
@@ -46,7 +46,7 @@ class BaseEntityProcessor(BaseHandler):
|
|
|
46
46
|
async def parse_items(
|
|
47
47
|
self,
|
|
48
48
|
mapping: ResourceConfig,
|
|
49
|
-
raw_data: list[
|
|
49
|
+
raw_data: list[RAW_ITEM],
|
|
50
50
|
parse_all: bool = False,
|
|
51
51
|
) -> EntitySelectorDiff:
|
|
52
52
|
"""Public method to parse raw entity data and map it to an EntityDiff.
|
|
@@ -10,7 +10,7 @@ from port_ocean.core.handlers.entity_processor.base import BaseEntityProcessor
|
|
|
10
10
|
from port_ocean.core.handlers.port_app_config.models import ResourceConfig
|
|
11
11
|
from port_ocean.core.models import Entity
|
|
12
12
|
from port_ocean.core.ocean_types import (
|
|
13
|
-
|
|
13
|
+
RAW_ITEM,
|
|
14
14
|
EntitySelectorDiff,
|
|
15
15
|
)
|
|
16
16
|
from port_ocean.exceptions.core import EntityProcessorException
|
|
@@ -122,7 +122,7 @@ class JQEntityProcessor(BaseEntityProcessor):
|
|
|
122
122
|
async def _parse_items(
|
|
123
123
|
self,
|
|
124
124
|
mapping: ResourceConfig,
|
|
125
|
-
raw_results: list[
|
|
125
|
+
raw_results: list[RAW_ITEM],
|
|
126
126
|
parse_all: bool = False,
|
|
127
127
|
) -> EntitySelectorDiff:
|
|
128
128
|
raw_entity_mappings: dict[str, Any] = mapping.port.entity.mappings.dict(
|
|
@@ -153,4 +153,4 @@ class JQEntityProcessor(BaseEntityProcessor):
|
|
|
153
153
|
else:
|
|
154
154
|
failed_entities.append(parsed_entity)
|
|
155
155
|
|
|
156
|
-
return
|
|
156
|
+
return EntitySelectorDiff(passed=passed_entities, failed=failed_entities)
|
|
@@ -22,9 +22,8 @@ from port_ocean.core.ocean_types import (
|
|
|
22
22
|
RAW_RESULT,
|
|
23
23
|
RESYNC_RESULT,
|
|
24
24
|
RawEntityDiff,
|
|
25
|
-
EntityDiff,
|
|
26
25
|
ASYNC_GENERATOR_RESYNC_TYPE,
|
|
27
|
-
|
|
26
|
+
RAW_ITEM,
|
|
28
27
|
EntitySelectorDiff,
|
|
29
28
|
)
|
|
30
29
|
from port_ocean.core.utils import zip_and_sum
|
|
@@ -123,7 +122,7 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
123
122
|
|
|
124
123
|
async def _calculate_raw(
|
|
125
124
|
self,
|
|
126
|
-
raw_diff: list[tuple[ResourceConfig, list[
|
|
125
|
+
raw_diff: list[tuple[ResourceConfig, list[RAW_ITEM]]],
|
|
127
126
|
parse_all: bool = False,
|
|
128
127
|
) -> list[EntitySelectorDiff]:
|
|
129
128
|
return await asyncio.gather(
|
|
@@ -139,40 +138,23 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
139
138
|
results: list[dict[Any, Any]],
|
|
140
139
|
user_agent_type: UserAgentType,
|
|
141
140
|
parse_all: bool = False,
|
|
142
|
-
) ->
|
|
141
|
+
) -> EntitySelectorDiff:
|
|
143
142
|
objects_diff = await self._calculate_raw([(resource, results)], parse_all)
|
|
143
|
+
await self.entities_state_applier.upsert(
|
|
144
|
+
objects_diff[0].passed, user_agent_type
|
|
145
|
+
)
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
await self.entities_state_applier.upsert(entities_after, user_agent_type)
|
|
147
|
-
|
|
148
|
-
# If an entity didn't pass the JQ selector, we want to delete it if it exists in Port
|
|
149
|
-
for entity_to_delete in objects_diff[0]["failed"]:
|
|
150
|
-
is_owner = (
|
|
151
|
-
await ocean.port_client.does_integration_has_ownership_over_entity(
|
|
152
|
-
entity_to_delete, user_agent_type
|
|
153
|
-
)
|
|
154
|
-
)
|
|
155
|
-
if not is_owner:
|
|
156
|
-
logger.info(
|
|
157
|
-
f"Skipping deletion of entity {entity_to_delete.identifier}, "
|
|
158
|
-
f"Couldn't find an entity that's related to the current integration."
|
|
159
|
-
)
|
|
160
|
-
continue
|
|
161
|
-
await self.entities_state_applier.delete(
|
|
162
|
-
objects_diff[0]["failed"], user_agent_type
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
return entities_after
|
|
147
|
+
return objects_diff[0]
|
|
166
148
|
|
|
167
149
|
async def _unregister_resource_raw(
|
|
168
150
|
self,
|
|
169
151
|
resource: ResourceConfig,
|
|
170
|
-
results: list[
|
|
152
|
+
results: list[RAW_ITEM],
|
|
171
153
|
user_agent_type: UserAgentType,
|
|
172
154
|
) -> list[Entity]:
|
|
173
155
|
objects_diff = await self._calculate_raw([(resource, results)])
|
|
174
156
|
|
|
175
|
-
entities_after: list[Entity] = objects_diff[0]
|
|
157
|
+
entities_after: list[Entity] = objects_diff[0].passed
|
|
176
158
|
await self.entities_state_applier.delete(entities_after, user_agent_type)
|
|
177
159
|
logger.info("Finished unregistering change")
|
|
178
160
|
return entities_after
|
|
@@ -189,17 +171,21 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
189
171
|
else:
|
|
190
172
|
async_generators.append(result)
|
|
191
173
|
|
|
192
|
-
entities =
|
|
193
|
-
|
|
194
|
-
|
|
174
|
+
entities = (
|
|
175
|
+
await self._register_resource_raw(
|
|
176
|
+
resource_config, raw_results, user_agent_type
|
|
177
|
+
)
|
|
178
|
+
).passed
|
|
195
179
|
|
|
196
180
|
for generator in async_generators:
|
|
197
181
|
try:
|
|
198
182
|
async for items in generator:
|
|
199
183
|
entities.extend(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
184
|
+
(
|
|
185
|
+
await self._register_resource_raw(
|
|
186
|
+
resource_config, items, user_agent_type
|
|
187
|
+
)
|
|
188
|
+
).passed
|
|
203
189
|
)
|
|
204
190
|
except* OceanAbortException as error:
|
|
205
191
|
errors.append(error)
|
|
@@ -233,13 +219,44 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
233
219
|
resource for resource in config.resources if resource.kind == kind
|
|
234
220
|
]
|
|
235
221
|
|
|
236
|
-
|
|
222
|
+
diffs: list[EntitySelectorDiff] = await asyncio.gather(
|
|
237
223
|
*(
|
|
238
224
|
self._register_resource_raw(resource, results, user_agent_type, True)
|
|
239
225
|
for resource in resource_mappings
|
|
240
226
|
)
|
|
241
227
|
)
|
|
242
228
|
|
|
229
|
+
registered_entities, entities_to_delete = zip_and_sum(
|
|
230
|
+
(entities_diff.passed, entities_diff.failed) for entities_diff in diffs
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
registered_entities_attributes = {
|
|
234
|
+
(entity.identifier, entity.blueprint) for entity in registered_entities
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
filtered_entities_to_delete: list[Entity] = (
|
|
238
|
+
await ocean.port_client.search_batch_entities(
|
|
239
|
+
user_agent_type,
|
|
240
|
+
[
|
|
241
|
+
entity
|
|
242
|
+
for entity in entities_to_delete
|
|
243
|
+
if (entity.identifier, entity.blueprint)
|
|
244
|
+
not in registered_entities_attributes
|
|
245
|
+
],
|
|
246
|
+
)
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
if filtered_entities_to_delete:
|
|
250
|
+
logger.info(
|
|
251
|
+
f"Deleting {len(filtered_entities_to_delete)} entities that didn't pass any of the selectors"
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
await self.entities_state_applier.delete(
|
|
255
|
+
filtered_entities_to_delete, user_agent_type
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
return registered_entities
|
|
259
|
+
|
|
243
260
|
async def unregister_raw(
|
|
244
261
|
self,
|
|
245
262
|
kind: str,
|
|
@@ -306,16 +323,13 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
|
|
|
306
323
|
[(mapping, raw_desired_state["after"]) for mapping in resource_mappings]
|
|
307
324
|
)
|
|
308
325
|
|
|
309
|
-
entities_before_flatten =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
]
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
for sublist in [d["passed"] for d in entities_after]
|
|
317
|
-
for item in sublist
|
|
318
|
-
]
|
|
326
|
+
entities_before_flatten: list[Entity] = sum(
|
|
327
|
+
(entities_diff.passed for entities_diff in entities_before), []
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
entities_after_flatten: list[Entity] = sum(
|
|
331
|
+
(entities_diff.passed for entities_diff in entities_after), []
|
|
332
|
+
)
|
|
319
333
|
|
|
320
334
|
await self.entities_state_applier.apply_diff(
|
|
321
335
|
{"before": entities_before_flatten, "after": entities_after_flatten},
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
from typing import TypedDict, Any, AsyncIterator, Callable, Awaitable
|
|
1
|
+
from typing import TypedDict, Any, AsyncIterator, Callable, Awaitable, NamedTuple
|
|
2
2
|
|
|
3
3
|
from port_ocean.core.models import Entity
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
RAW_ITEM = dict[Any, Any]
|
|
7
|
+
RAW_RESULT = list[RAW_ITEM]
|
|
8
|
+
ASYNC_GENERATOR_RESYNC_TYPE = AsyncIterator[RAW_RESULT]
|
|
9
|
+
RESYNC_RESULT = list[RAW_ITEM | ASYNC_GENERATOR_RESYNC_TYPE]
|
|
10
|
+
|
|
11
|
+
LISTENER_RESULT = Awaitable[RAW_RESULT] | ASYNC_GENERATOR_RESYNC_TYPE
|
|
12
|
+
RESYNC_EVENT_LISTENER = Callable[[str], LISTENER_RESULT]
|
|
13
|
+
START_EVENT_LISTENER = Callable[[], Awaitable[None]]
|
|
7
14
|
|
|
8
15
|
|
|
9
16
|
class RawEntityDiff(TypedDict):
|
|
10
|
-
before: list[
|
|
11
|
-
after: list[
|
|
17
|
+
before: list[RAW_ITEM]
|
|
18
|
+
after: list[RAW_ITEM]
|
|
12
19
|
|
|
13
20
|
|
|
14
21
|
class EntityDiff(TypedDict):
|
|
@@ -16,21 +23,11 @@ class EntityDiff(TypedDict):
|
|
|
16
23
|
after: list[Entity]
|
|
17
24
|
|
|
18
25
|
|
|
19
|
-
class EntitySelectorDiff(
|
|
26
|
+
class EntitySelectorDiff(NamedTuple):
|
|
20
27
|
passed: list[Entity]
|
|
21
28
|
failed: list[Entity]
|
|
22
29
|
|
|
23
30
|
|
|
24
|
-
RAW_ITEM = dict[Any, Any]
|
|
25
|
-
RAW_RESULT = list[RAW_ITEM]
|
|
26
|
-
ASYNC_GENERATOR_RESYNC_TYPE = AsyncIterator[RAW_RESULT]
|
|
27
|
-
RESYNC_RESULT = list[RAW_ITEM | ASYNC_GENERATOR_RESYNC_TYPE]
|
|
28
|
-
|
|
29
|
-
LISTENER_RESULT = Awaitable[RAW_RESULT] | ASYNC_GENERATOR_RESYNC_TYPE
|
|
30
|
-
RESYNC_EVENT_LISTENER = Callable[[str], LISTENER_RESULT]
|
|
31
|
-
START_EVENT_LISTENER = Callable[[], Awaitable[None]]
|
|
32
|
-
|
|
33
|
-
|
|
34
31
|
class IntegrationEventsCallbacks(TypedDict):
|
|
35
32
|
start: list[START_EVENT_LISTENER]
|
|
36
33
|
resync: dict[str | None, list[RESYNC_EVENT_LISTENER]]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "port-ocean"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.14"
|
|
4
4
|
description = "Port Ocean is a CLI tool for managing your Port projects."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
homepage = "https://app.getport.io"
|
|
@@ -40,12 +40,12 @@ pydantic = "^1.10.8"
|
|
|
40
40
|
loguru = "^0.7.0"
|
|
41
41
|
pyyaml = "^6.0"
|
|
42
42
|
werkzeug = ">=2.3.4,<4.0.0"
|
|
43
|
-
fastapi = ">=0.100,<0.
|
|
43
|
+
fastapi = ">=0.100,<0.111"
|
|
44
44
|
uvicorn = ">=0.22,<0.30"
|
|
45
45
|
confluent-kafka = "^2.1.1"
|
|
46
46
|
httpx = ">=0.24.1,<0.28.0"
|
|
47
47
|
pyjq = "^2.6.0"
|
|
48
|
-
urllib3 = "
|
|
48
|
+
urllib3 = ">=1.26.16,<3.0.0"
|
|
49
49
|
six = "^1.16.0"
|
|
50
50
|
pyhumps = "^3.8.0"
|
|
51
51
|
pydispatcher = "^2.0.7"
|
|
@@ -66,7 +66,7 @@ cli = ["click", "rich", "cookiecutter", "jinja2-time"]
|
|
|
66
66
|
pytest = ">=7.2,<9.0"
|
|
67
67
|
black = ">=23.3,<25.0"
|
|
68
68
|
mypy = "^1.3.0"
|
|
69
|
-
pylint = "
|
|
69
|
+
pylint = ">=2.17.4,<4.0.0"
|
|
70
70
|
types-pyyaml = "^6.0.12.10"
|
|
71
71
|
ruff = "^0.0.278"
|
|
72
72
|
types-toml = "^0.10.8.6"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/cli/cookiecutter/hooks/post_gen_project.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entities_state_applier/__init__.py
RENAMED
|
File without changes
|
{port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entities_state_applier/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/entity_processor/__init__.py
RENAMED
|
File without changes
|
{port_ocean-0.5.13 → port_ocean-0.5.14}/port_ocean/core/handlers/port_app_config/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|