dex-python-sdk 0.4.0__tar.gz → 0.5.0__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.
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/PKG-INFO +1 -1
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/__init__.py +2 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/async_client.py +68 -1
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/client.py +68 -1
- dex_python_sdk-0.5.0/dex/dexpb/dex_pb2.py +501 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/dexpb/dex_pb2.pyi +22 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/dexpb/dex_pb2_grpc.py +43 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/stream.py +17 -1
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/pyproject.toml +1 -1
- dex_python_sdk-0.4.0/dex/dexpb/dex_pb2.py +0 -497
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/LEGACY_NOTICES.md +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/LICENSE +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/README.md +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_async_value_hydrator.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_async_worker_dispatcher.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_async_worker_service.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_grpc_errors.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_invocation_context.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_native.pyi +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_utils.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_value_hydrator.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_value_mapper.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_worker_dispatcher.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/_worker_service.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/async_worker.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/attribute.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/attribute_match.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/blob_cache.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/channel.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/client_options.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/codec.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/condition.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/context.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/dexpb/__init__.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/flow.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/flow_config.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/flow_info.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/flow_options.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/flow_result.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/py.typed +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/runtime_errors.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/step.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/step_execution.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/subflow.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/timer.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/wait.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/worker.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/dex/worker_options.py +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/Cargo.lock +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/Cargo.toml +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache/Cargo.toml +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache/LICENSE +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache/src/config.rs +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache/src/entry.rs +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache/src/error.rs +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache/src/format.rs +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache/src/lib.rs +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache/src/policy.rs +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache/src/store.rs +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache/tests/blob_cache_integration.rs +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache-python/Cargo.toml +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache-python/LICENSE +0 -0
- {dex_python_sdk-0.4.0 → dex_python_sdk-0.5.0}/sdk-rust/crates/dex-blob-cache-python/src/lib.rs +0 -0
|
@@ -103,6 +103,7 @@ from dex.stream import (
|
|
|
103
103
|
BufferedTextStream,
|
|
104
104
|
Stream,
|
|
105
105
|
StreamMessage,
|
|
106
|
+
StreamMessagesPage,
|
|
106
107
|
)
|
|
107
108
|
from dex.subflow import SubFlow
|
|
108
109
|
from dex.timer import Timer
|
|
@@ -190,6 +191,7 @@ __all__ = [
|
|
|
190
191
|
"StepOptions",
|
|
191
192
|
"Stream",
|
|
192
193
|
"StreamMessage",
|
|
194
|
+
"StreamMessagesPage",
|
|
193
195
|
"StopFlowOptions",
|
|
194
196
|
"StopType",
|
|
195
197
|
"Timer",
|
|
@@ -48,7 +48,7 @@ from dex.flow_result import FlowResult, flow_result_from_proto
|
|
|
48
48
|
from dex.runtime_errors import FlowErrorType
|
|
49
49
|
from dex.step import RetryPolicy, StepDurability
|
|
50
50
|
from dex.step_execution import StepExecutionId, TimerId
|
|
51
|
-
from dex.stream import Stream, StreamMessage
|
|
51
|
+
from dex.stream import Stream, StreamMessage, StreamMessagesPage
|
|
52
52
|
|
|
53
53
|
InputT = TypeVar("InputT")
|
|
54
54
|
OutputT = TypeVar("OutputT")
|
|
@@ -767,6 +767,73 @@ class AsyncClient:
|
|
|
767
767
|
response.message.source,
|
|
768
768
|
)
|
|
769
769
|
|
|
770
|
+
async def list_stream_messages(
|
|
771
|
+
self,
|
|
772
|
+
flow_id: str,
|
|
773
|
+
stream: Stream[ValueT],
|
|
774
|
+
page_size: int,
|
|
775
|
+
before_page_token: str = "",
|
|
776
|
+
) -> StreamMessagesPage[ValueT]:
|
|
777
|
+
"""Await one newest-first page of retained Stream messages without waiting for writes.
|
|
778
|
+
|
|
779
|
+
An empty token starts at the retained tail. Pass the returned page token
|
|
780
|
+
unchanged to read older messages. Trimming may remove messages between pages.
|
|
781
|
+
|
|
782
|
+
Args:
|
|
783
|
+
flow_id: Logical Flow instance ID used as the Stream instance key.
|
|
784
|
+
stream: Exact Stream object registered in one Flow schema.
|
|
785
|
+
page_size: Positive maximum message count within the server-configured limit.
|
|
786
|
+
before_page_token: Opaque token from the preceding page, or ``""`` first.
|
|
787
|
+
|
|
788
|
+
Returns:
|
|
789
|
+
Decoded messages in newest-first order and the next-page token.
|
|
790
|
+
|
|
791
|
+
Raises:
|
|
792
|
+
ValueError: If ``page_size`` is not positive.
|
|
793
|
+
FlowDefinitionError: If the Stream is not registered.
|
|
794
|
+
ValueMappingError: If a retained message cannot be decoded.
|
|
795
|
+
DexServiceError: If FlowService cannot list the Stream.
|
|
796
|
+
"""
|
|
797
|
+
if page_size < 1:
|
|
798
|
+
raise ValueError("Stream page size must be positive")
|
|
799
|
+
flow = self.registry._flow_for_stream(stream)
|
|
800
|
+
response = cast(
|
|
801
|
+
pb.ListStreamMessagesResponse,
|
|
802
|
+
await self._call(
|
|
803
|
+
self._service.ListStreamMessages,
|
|
804
|
+
pb.ListStreamMessagesRequest(
|
|
805
|
+
flow_id=require_name(flow_id),
|
|
806
|
+
flow_type=flow.name,
|
|
807
|
+
stream_name=stream.name,
|
|
808
|
+
page_size=page_size,
|
|
809
|
+
before_page_token=before_page_token,
|
|
810
|
+
),
|
|
811
|
+
"list_stream_messages",
|
|
812
|
+
flow_id,
|
|
813
|
+
"none",
|
|
814
|
+
),
|
|
815
|
+
)
|
|
816
|
+
messages: list[StreamMessage[ValueT]] = []
|
|
817
|
+
for message in response.messages:
|
|
818
|
+
if (
|
|
819
|
+
not message.HasField("value")
|
|
820
|
+
or not message.HasField("created_time")
|
|
821
|
+
or not message.resume_token
|
|
822
|
+
):
|
|
823
|
+
raise ValueError("Dex returned an incomplete Stream message")
|
|
824
|
+
messages.append(
|
|
825
|
+
StreamMessage(
|
|
826
|
+
self._values.decode(
|
|
827
|
+
message.value,
|
|
828
|
+
self._values.codec(stream.value_type),
|
|
829
|
+
),
|
|
830
|
+
message.resume_token,
|
|
831
|
+
message.created_time.ToDatetime(tzinfo=timezone.utc),
|
|
832
|
+
message.source,
|
|
833
|
+
)
|
|
834
|
+
)
|
|
835
|
+
return StreamMessagesPage(messages, response.next_page_token)
|
|
836
|
+
|
|
770
837
|
async def wait_for_flow(
|
|
771
838
|
self,
|
|
772
839
|
flow_id: str,
|
|
@@ -48,7 +48,7 @@ from dex.flow_result import FlowResult, flow_result_from_proto
|
|
|
48
48
|
from dex.runtime_errors import FlowErrorType
|
|
49
49
|
from dex.step import RetryPolicy, StepDurability
|
|
50
50
|
from dex.step_execution import StepExecutionId, TimerId
|
|
51
|
-
from dex.stream import Stream, StreamMessage
|
|
51
|
+
from dex.stream import Stream, StreamMessage, StreamMessagesPage
|
|
52
52
|
|
|
53
53
|
InputT = TypeVar("InputT")
|
|
54
54
|
OutputT = TypeVar("OutputT")
|
|
@@ -766,6 +766,73 @@ class Client:
|
|
|
766
766
|
response.message.source,
|
|
767
767
|
)
|
|
768
768
|
|
|
769
|
+
def list_stream_messages(
|
|
770
|
+
self,
|
|
771
|
+
flow_id: str,
|
|
772
|
+
stream: Stream[ValueT],
|
|
773
|
+
page_size: int,
|
|
774
|
+
before_page_token: str = "",
|
|
775
|
+
) -> StreamMessagesPage[ValueT]:
|
|
776
|
+
"""Return one newest-first page of retained Stream messages without waiting.
|
|
777
|
+
|
|
778
|
+
An empty token starts at the retained tail. Pass the returned page token
|
|
779
|
+
unchanged to read older messages. Trimming may remove messages between pages.
|
|
780
|
+
|
|
781
|
+
Args:
|
|
782
|
+
flow_id: Logical Flow instance ID used as the Stream instance key.
|
|
783
|
+
stream: Exact Stream object registered in one Flow schema.
|
|
784
|
+
page_size: Positive maximum message count within the server-configured limit.
|
|
785
|
+
before_page_token: Opaque token from the preceding page, or ``""`` first.
|
|
786
|
+
|
|
787
|
+
Returns:
|
|
788
|
+
Decoded messages in newest-first order and the next-page token.
|
|
789
|
+
|
|
790
|
+
Raises:
|
|
791
|
+
ValueError: If ``page_size`` is not positive.
|
|
792
|
+
FlowDefinitionError: If the Stream is not registered.
|
|
793
|
+
ValueMappingError: If a retained message cannot be decoded.
|
|
794
|
+
DexServiceError: If FlowService cannot list the Stream.
|
|
795
|
+
"""
|
|
796
|
+
if page_size < 1:
|
|
797
|
+
raise ValueError("Stream page size must be positive")
|
|
798
|
+
flow = self.registry._flow_for_stream(stream)
|
|
799
|
+
response = cast(
|
|
800
|
+
pb.ListStreamMessagesResponse,
|
|
801
|
+
self._call(
|
|
802
|
+
self._service.ListStreamMessages,
|
|
803
|
+
pb.ListStreamMessagesRequest(
|
|
804
|
+
flow_id=require_name(flow_id),
|
|
805
|
+
flow_type=flow.name,
|
|
806
|
+
stream_name=stream.name,
|
|
807
|
+
page_size=page_size,
|
|
808
|
+
before_page_token=before_page_token,
|
|
809
|
+
),
|
|
810
|
+
"list_stream_messages",
|
|
811
|
+
flow_id,
|
|
812
|
+
"none",
|
|
813
|
+
),
|
|
814
|
+
)
|
|
815
|
+
messages: list[StreamMessage[ValueT]] = []
|
|
816
|
+
for message in response.messages:
|
|
817
|
+
if (
|
|
818
|
+
not message.HasField("value")
|
|
819
|
+
or not message.HasField("created_time")
|
|
820
|
+
or not message.resume_token
|
|
821
|
+
):
|
|
822
|
+
raise ValueError("Dex returned an incomplete Stream message")
|
|
823
|
+
messages.append(
|
|
824
|
+
StreamMessage(
|
|
825
|
+
self._values.decode(
|
|
826
|
+
message.value,
|
|
827
|
+
self._values.codec(stream.value_type),
|
|
828
|
+
),
|
|
829
|
+
message.resume_token,
|
|
830
|
+
message.created_time.ToDatetime(tzinfo=timezone.utc),
|
|
831
|
+
message.source,
|
|
832
|
+
)
|
|
833
|
+
)
|
|
834
|
+
return StreamMessagesPage(messages, response.next_page_token)
|
|
835
|
+
|
|
769
836
|
def wait_for_flow(
|
|
770
837
|
self,
|
|
771
838
|
flow_id: str,
|