dex-connector-close 0.1.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.
Files changed (26) hide show
  1. dex_connector_close-0.1.0/.gitignore +6 -0
  2. dex_connector_close-0.1.0/PKG-INFO +47 -0
  3. dex_connector_close-0.1.0/README.md +36 -0
  4. dex_connector_close-0.1.0/examples/close_lookup/__init__.py +3 -0
  5. dex_connector_close-0.1.0/examples/close_lookup/flow.py +125 -0
  6. dex_connector_close-0.1.0/examples/close_lookup/worker.py +51 -0
  7. dex_connector_close-0.1.0/pyproject.toml +37 -0
  8. dex_connector_close-0.1.0/src/dex_connectors/close/__init__.py +50 -0
  9. dex_connector_close-0.1.0/src/dex_connectors/close/_generated/__init__.py +2 -0
  10. dex_connector_close-0.1.0/src/dex_connectors/close/_generated/config.py +25 -0
  11. dex_connector_close-0.1.0/src/dex_connectors/close/_generated/connection.py +131 -0
  12. dex_connector_close-0.1.0/src/dex_connectors/close/_generated/definitions.py +57 -0
  13. dex_connector_close-0.1.0/src/dex_connectors/close/_generated/mock.py +125 -0
  14. dex_connector_close-0.1.0/src/dex_connectors/close/_generated/models.py +64 -0
  15. dex_connector_close-0.1.0/src/dex_connectors/close/_generated/steps.py +131 -0
  16. dex_connector_close-0.1.0/src/dex_connectors/close/client.py +329 -0
  17. dex_connector_close-0.1.0/src/dex_connectors/close/closemock/__init__.py +52 -0
  18. dex_connector_close-0.1.0/src/dex_connectors/close/connection.py +46 -0
  19. dex_connector_close-0.1.0/src/dex_connectors/close/dex-connector.json +82 -0
  20. dex_connector_close-0.1.0/src/dex_connectors/close/models.py +20 -0
  21. dex_connector_close-0.1.0/src/dex_connectors/close/py.typed +0 -0
  22. dex_connector_close-0.1.0/src/dex_connectors/close/steps.py +33 -0
  23. dex_connector_close-0.1.0/tests/test_conformance.py +33 -0
  24. dex_connector_close-0.1.0/tests/test_manifest_contract.py +15 -0
  25. dex_connector_close-0.1.0/tests/test_operations.py +159 -0
  26. dex_connector_close-0.1.0/uv.lock +932 -0
@@ -0,0 +1,6 @@
1
+ /.dex-local/dexcli
2
+ /.dex-local/dex-server-zd
3
+ /.dex-local/data/
4
+ /.dex-local/cli.log
5
+ /.dex-local/visualize.json
6
+ /.dex-local/visualize.err
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.5
2
+ Name: dex-connector-close
3
+ Version: 0.1.0
4
+ Summary: Close connector for Dex Flows
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: dex-connectors-sdk==0.1.0
8
+ Requires-Dist: dex-python-sdk>=1.28.0
9
+ Requires-Dist: httpx>=0.27
10
+ Description-Content-Type: text/markdown
11
+
12
+ # Close connector for Python
13
+
14
+ Install with `pip install dex-connector-close==0.1.0`. The package requires
15
+ `dex-connectors-sdk==0.1.0` and `dex-python-sdk>=1.28.0`, and implements the
16
+ manifest Queries `listLeads` and `getLead` with the same branches, defaults,
17
+ and failure classification as the Go module.
18
+
19
+ ## Operations
20
+
21
+ | Operation | Factory | Happy branch | Optional branches |
22
+ | --- | --- | --- | --- |
23
+ | `listLeads` | `new_list_leads_step` | `listed` | `providerRejected`, `invalidResponse`, `defect` |
24
+ | `getLead` | `new_get_lead_step` | `found` | `notFound`, `providerRejected`, `invalidResponse`, `defect` |
25
+
26
+ `listLeads` reads an offset page: `skip` is nonnegative and `limit` zero means
27
+ 100, at most 100. `getLead` requires a Close lead ID that starts with `lead_`
28
+ and selects `notFound` for HTTP 404. 408, 409, 429, 5xx, and transport failures
29
+ retry; 401, 403, and other non-200 responses select `providerRejected`.
30
+
31
+ ## Authorization
32
+
33
+ Create a Dex Web connection named `close` as described in the
34
+ [connector README](../README.md#connection). The API key travels only as the
35
+ HTTP Basic username and is resolved for every attempt.
36
+
37
+ ## Example
38
+
39
+ [`examples/close_lookup`](examples/close_lookup/flow.py) lists a page of leads
40
+ and reads the first one. Run the Worker with
41
+ `uv run python -m examples.close_lookup.worker` after `dexcli dev` has loaded a
42
+ project containing the `close` connection.
43
+
44
+ ## Tests
45
+
46
+ `closemock.Mock` scripts both Queries and defaults to the manifest answers.
47
+ Run `uv run pytest tests` for provider parity and manifest contract checks.
@@ -0,0 +1,36 @@
1
+ # Close connector for Python
2
+
3
+ Install with `pip install dex-connector-close==0.1.0`. The package requires
4
+ `dex-connectors-sdk==0.1.0` and `dex-python-sdk>=1.28.0`, and implements the
5
+ manifest Queries `listLeads` and `getLead` with the same branches, defaults,
6
+ and failure classification as the Go module.
7
+
8
+ ## Operations
9
+
10
+ | Operation | Factory | Happy branch | Optional branches |
11
+ | --- | --- | --- | --- |
12
+ | `listLeads` | `new_list_leads_step` | `listed` | `providerRejected`, `invalidResponse`, `defect` |
13
+ | `getLead` | `new_get_lead_step` | `found` | `notFound`, `providerRejected`, `invalidResponse`, `defect` |
14
+
15
+ `listLeads` reads an offset page: `skip` is nonnegative and `limit` zero means
16
+ 100, at most 100. `getLead` requires a Close lead ID that starts with `lead_`
17
+ and selects `notFound` for HTTP 404. 408, 409, 429, 5xx, and transport failures
18
+ retry; 401, 403, and other non-200 responses select `providerRejected`.
19
+
20
+ ## Authorization
21
+
22
+ Create a Dex Web connection named `close` as described in the
23
+ [connector README](../README.md#connection). The API key travels only as the
24
+ HTTP Basic username and is resolved for every attempt.
25
+
26
+ ## Example
27
+
28
+ [`examples/close_lookup`](examples/close_lookup/flow.py) lists a page of leads
29
+ and reads the first one. Run the Worker with
30
+ `uv run python -m examples.close_lookup.worker` after `dexcli dev` has loaded a
31
+ project containing the `close` connection.
32
+
33
+ ## Tests
34
+
35
+ `closemock.Mock` scripts both Queries and defaults to the manifest answers.
36
+ Run `uv run pytest tests` for provider parity and manifest contract checks.
@@ -0,0 +1,3 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ """Close lookup example Flow."""
@@ -0,0 +1,125 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ """Runnable Close lookup Flow: list leads, then read the first lead."""
4
+
5
+ from dataclasses import dataclass, field
6
+
7
+ import dex
8
+ from dex_connectors.sdk import QueryResult
9
+
10
+ from dex_connectors.close import (
11
+ Connection,
12
+ GetLeadInput,
13
+ Lead,
14
+ LeadPage,
15
+ ListLeadsInput,
16
+ new_get_lead_step,
17
+ new_list_leads_step,
18
+ )
19
+
20
+ FLOW_TYPE = "CloseLookup"
21
+ CONNECTION_NAME = "close"
22
+ _FIRST_STEP_TYPE = "ReadCloseFirst"
23
+ _SECOND_STEP_TYPE = "ReadCloseSecond"
24
+ _ANNOTATION_GROUP = {"groupId": "close-lookup", "groupLabel": "Close lookup"}
25
+
26
+
27
+ @dataclass(frozen=True, slots=True)
28
+ class CloseLookupRequest:
29
+ """Number of leads to skip before the page whose first lead is read."""
30
+
31
+ skip: int = field(default=0, metadata={"dex_json_omit_default": True})
32
+
33
+
34
+ @dataclass(frozen=True, slots=True)
35
+ class CloseLookupOutcome:
36
+ """The first lead on the page, or an empty lead when the page had none."""
37
+
38
+ lead: Lead = field(default_factory=Lead)
39
+
40
+
41
+ def map_to_list_leads_input(request: CloseLookupRequest) -> ListLeadsInput:
42
+ """Read a page of ten leads after the requested offset."""
43
+ return ListLeadsInput(skip=request.skip, limit=10)
44
+
45
+
46
+ def map_to_get_lead_input(lead: GetLeadInput) -> GetLeadInput:
47
+ """Read the lead chosen from the page unchanged."""
48
+ return lead
49
+
50
+
51
+ # dex:group group-id:close-lookup group-label:"Close lookup"
52
+ # dex:explanation text:"Start the lookup with the requested lead offset."
53
+ class _StartRequest(dex.Step[CloseLookupRequest]):
54
+ def get_step_type(self) -> str:
55
+ return "StartCloseLookup"
56
+
57
+ def execute(self, context: dex.Context, input: CloseLookupRequest) -> dex.StepDecision:
58
+ if input.skip < 0:
59
+ return dex.force_fail("skip must not be negative")
60
+ return dex.go_to(dex.StepRef(_FIRST_STEP_TYPE), input)
61
+
62
+
63
+ # dex:group group-id:close-lookup group-label:"Close lookup"
64
+ # dex:explanation text:"Complete when the page is empty, otherwise read its first lead."
65
+ class _AfterFirst(dex.Step[QueryResult[LeadPage]]):
66
+ def get_step_type(self) -> str:
67
+ return "AfterCloseFirst"
68
+
69
+ def execute(self, context: dex.Context, input: QueryResult[LeadPage]) -> dex.StepDecision:
70
+ if not input.value.leads:
71
+ return dex.graceful_complete(CloseLookupOutcome())
72
+ return dex.go_to(dex.StepRef(_SECOND_STEP_TYPE), GetLeadInput(input.value.leads[0].id))
73
+
74
+
75
+ # dex:group group-id:close-lookup group-label:"Close lookup"
76
+ # dex:explanation text:"Complete with the lead Close returned."
77
+ class _CompleteLookup(dex.Step[QueryResult[Lead]]):
78
+ def get_step_type(self) -> str:
79
+ return "CompleteCloseLookup"
80
+
81
+ def execute(self, context: dex.Context, input: QueryResult[Lead]) -> dex.StepDecision:
82
+ return dex.graceful_complete(CloseLookupOutcome(input.value))
83
+
84
+
85
+ class CloseLookupFlow(dex.Flow[CloseLookupRequest]):
86
+ """List Close leads and read the first one through the static close connection."""
87
+
88
+ def __init__(self, connection: Connection) -> None:
89
+ if connection.reference.name != CONNECTION_NAME:
90
+ raise ValueError("Close lookup requires the static close connection")
91
+ self._start = _StartRequest()
92
+ self._after_first = _AfterFirst()
93
+ self._complete = _CompleteLookup()
94
+ self._list = new_list_leads_step(
95
+ step_type=_FIRST_STEP_TYPE,
96
+ step_input_type=CloseLookupRequest,
97
+ annotations={**_ANNOTATION_GROUP, "explanation": "Read Close records."},
98
+ connection=connection,
99
+ connection_name=CONNECTION_NAME,
100
+ map_to_operation_input=map_to_list_leads_input,
101
+ listed=self._after_first,
102
+ )
103
+ self._get = new_get_lead_step(
104
+ step_type=_SECOND_STEP_TYPE,
105
+ step_input_type=GetLeadInput,
106
+ annotations={**_ANNOTATION_GROUP, "explanation": "Read the related Close resource."},
107
+ connection=connection,
108
+ connection_name=CONNECTION_NAME,
109
+ map_to_operation_input=map_to_get_lead_input,
110
+ found=self._complete,
111
+ )
112
+
113
+ def get_flow_type(self) -> str:
114
+ """Return the stable Flow identity used in Dex Web."""
115
+ return FLOW_TYPE
116
+
117
+ def get_steps(self) -> dex.StepList[CloseLookupRequest]:
118
+ """Register the start, both Close reads, and their result Steps."""
119
+ return dex.StepList.start_step(self._start).other_steps(
120
+ self._list, self._after_first, self._get, self._complete
121
+ )
122
+
123
+ def get_persistence_schema(self) -> dex.PersistenceSchema:
124
+ """Persist nothing; the outcome is the Flow's completion value."""
125
+ return dex.PersistenceSchema.of()
@@ -0,0 +1,51 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ """Worker entrypoint for the Close lookup Flow."""
4
+
5
+ import asyncio
6
+ import os
7
+ import tempfile
8
+ from pathlib import Path
9
+
10
+ import dex
11
+ from dex_connectors.sdk.projectconfig import load_from_environment
12
+
13
+ from dex_connectors.close import new_project_connection
14
+
15
+ from .flow import CONNECTION_NAME, CloseLookupFlow
16
+
17
+
18
+ async def run_worker() -> None:
19
+ """Load the named Dex Web connection and serve Close lookups."""
20
+ project = await load_from_environment()
21
+ connection = None
22
+ cache = None
23
+ try:
24
+ connection = new_project_connection(project, CONNECTION_NAME)
25
+ registry = dex.Registry([CloseLookupFlow(connection)], allow_async_handlers=True)
26
+ cache_directory = os.environ.get(
27
+ "DEX_BLOB_CACHE_DIR", str(Path(tempfile.gettempdir()) / "dex-close-lookup-blobs")
28
+ )
29
+ cache = dex.open_blob_cache(dex.BlobCacheConfig(cache_directory, 1 << 30))
30
+ worker = dex.AsyncWorker(
31
+ registry,
32
+ cache,
33
+ dex.WorkerOptions(server_address=os.environ.get("DEX_FLOW_SERVICE_ADDRESS", "localhost:8801")),
34
+ )
35
+ async with worker:
36
+ await worker.start()
37
+ finally:
38
+ if connection is not None:
39
+ await connection.aclose()
40
+ if cache is not None:
41
+ cache.close()
42
+ await project.close()
43
+
44
+
45
+ def main() -> None:
46
+ """Run until the Worker stops or the process receives an interrupt."""
47
+ asyncio.run(run_worker())
48
+
49
+
50
+ if __name__ == "__main__":
51
+ main()
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "dex-connector-close"
7
+ version = "0.1.0"
8
+ description = "Close connector for Dex Flows"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ dependencies = ["dex-connectors-sdk==0.1.0", "dex-python-sdk>=1.28.0", "httpx>=0.27"]
13
+
14
+ [dependency-groups]
15
+ dev = ["pytest>=8", "pytest-asyncio>=0.24", "mypy>=1.13", "ruff>=0.7", "pyyaml>=6", "types-PyYAML>=6"]
16
+
17
+ [tool.hatch.build.targets.wheel]
18
+ packages = ["src/dex_connectors"]
19
+
20
+ [tool.pytest.ini_options]
21
+ testpaths = ["tests"]
22
+ pythonpath = [".", "src"]
23
+ asyncio_mode = "auto"
24
+ asyncio_default_fixture_loop_scope = "function"
25
+
26
+ [tool.mypy]
27
+ python_version = "3.11"
28
+ strict = true
29
+ mypy_path = "src"
30
+ explicit_package_bases = true
31
+
32
+ [tool.ruff]
33
+ target-version = "py311"
34
+ line-length = 110
35
+
36
+ [tool.ruff.lint]
37
+ select = ["E", "F", "I", "UP", "B"]
@@ -0,0 +1,50 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ """Close lead operations for Dex connector Steps."""
4
+
5
+ from .client import (
6
+ CONNECTOR_ID,
7
+ DEFECT,
8
+ FOUND,
9
+ GET_LEAD_DEFINITION,
10
+ INVALID_RESPONSE,
11
+ LIST_LEADS_DEFINITION,
12
+ LISTED,
13
+ NOT_FOUND,
14
+ PROVIDER_REJECTED,
15
+ Client,
16
+ Config,
17
+ Credentials,
18
+ GetLeadOperation,
19
+ ListLeadsOperation,
20
+ )
21
+ from .connection import Connection, new_connection, new_connection_with_operations, new_project_connection
22
+ from .models import GetLeadInput, Lead, LeadPage, ListLeadsInput
23
+ from .steps import new_get_lead_step, new_list_leads_step
24
+
25
+ __all__ = [
26
+ "Client",
27
+ "Config",
28
+ "Connection",
29
+ "Credentials",
30
+ "GetLeadInput",
31
+ "GetLeadOperation",
32
+ "ListLeadsInput",
33
+ "ListLeadsOperation",
34
+ "Lead",
35
+ "LeadPage",
36
+ "new_connection",
37
+ "new_connection_with_operations",
38
+ "new_get_lead_step",
39
+ "new_list_leads_step",
40
+ "new_project_connection",
41
+ "CONNECTOR_ID",
42
+ "DEFECT",
43
+ "FOUND",
44
+ "GET_LEAD_DEFINITION",
45
+ "INVALID_RESPONSE",
46
+ "LIST_LEADS_DEFINITION",
47
+ "LISTED",
48
+ "NOT_FOUND",
49
+ "PROVIDER_REJECTED",
50
+ ]
@@ -0,0 +1,2 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
@@ -0,0 +1,25 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ # ruff: noqa
4
+
5
+ from dataclasses import dataclass
6
+
7
+ from dex_connectors.sdk import SecretString
8
+
9
+
10
+ @dataclass(frozen=True, slots=True)
11
+ class Config:
12
+
13
+ base_url: str = "https://api.close.com/api/v1"
14
+ timeout_seconds: float = 30
15
+ max_response_bytes: int = 4194304
16
+
17
+ setattr(Config, '__module__', 'dex_connectors.close.client')
18
+
19
+
20
+ @dataclass(frozen=True, slots=True)
21
+ class Credentials:
22
+
23
+ api_key: SecretString
24
+
25
+ setattr(Credentials, '__module__', 'dex_connectors.close.client')
@@ -0,0 +1,131 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ # ruff: noqa
4
+
5
+ from typing import Any
6
+
7
+ import httpx
8
+ from dex_connectors.sdk import ConnectionRef, Query, Call, SecretString
9
+ from dex_connectors.sdk.projectconfig import ConnectionKey, LoadedProject
10
+
11
+ from ..client import Client, Config, Credentials
12
+ from .definitions import CONNECTOR_ID, GET_LEAD_DEFINITION, LIST_LEADS_DEFINITION
13
+ from ..models import GetLeadInput, Lead, LeadPage, ListLeadsInput
14
+
15
+ class Connection:
16
+
17
+ __slots__ = ('_list_leads', '_get_lead', '_client', 'reference')
18
+
19
+ def __init__(self,
20
+ reference: ConnectionRef,
21
+ list_leads: Query[ListLeadsInput, LeadPage],
22
+ get_lead: Query[GetLeadInput, Lead],
23
+ client: Client | None = None,
24
+ ) -> None:
25
+ reference.validate()
26
+ if reference.provider != CONNECTOR_ID or list_leads is None or get_lead is None:
27
+ raise ValueError("Close connection provider and operations are required")
28
+ if list_leads.definition().operation != LIST_LEADS_DEFINITION.operation:
29
+ raise ValueError("Close connection operation identity differs")
30
+ if get_lead.definition().operation != GET_LEAD_DEFINITION.operation:
31
+ raise ValueError("Close connection operation identity differs")
32
+ self.reference = reference
33
+ self._list_leads = list_leads
34
+ self._get_lead = get_lead
35
+ self._client = client
36
+
37
+ def list_leads(self) -> Query[ListLeadsInput, LeadPage]:
38
+ return self._list_leads
39
+
40
+ def get_lead(self) -> Query[GetLeadInput, Lead]:
41
+ return self._get_lead
42
+
43
+ async def aclose(self) -> None:
44
+ if self._client is not None:
45
+ await self._client.aclose()
46
+
47
+ def __repr__(self) -> str:
48
+ return "close.Connection([REDACTED])"
49
+
50
+ def __reduce__(self) -> tuple[object, ...]:
51
+ raise TypeError("Close connections cannot be serialized")
52
+
53
+ setattr(Connection, '__module__', 'dex_connectors.close.connection')
54
+
55
+
56
+ def new_connection(client: Client, reference: ConnectionRef) -> Connection:
57
+ if client is None:
58
+ raise ValueError("Close client is required")
59
+ return Connection(reference, client.list_leads(), client.get_lead(), client)
60
+
61
+ setattr(new_connection, '__module__', 'dex_connectors.close.connection')
62
+
63
+
64
+ def new_connection_with_operations(
65
+ list_leads: Query[ListLeadsInput, LeadPage],
66
+ get_lead: Query[GetLeadInput, Lead],
67
+ reference: ConnectionRef,
68
+ ) -> Connection:
69
+ return Connection(reference, list_leads, get_lead)
70
+
71
+ setattr(new_connection_with_operations, '__module__', 'dex_connectors.close.connection')
72
+
73
+
74
+ class _ProjectCredentialSource:
75
+
76
+ def __init__(self, project: LoadedProject, key: ConnectionKey) -> None:
77
+ self.project = project
78
+ self.key = key
79
+
80
+ async def resolve(self, call: Call) -> Credentials:
81
+ material = await self.project.resolve_credential(self.key, str(call.id))
82
+ api_key = material.get("api_key")
83
+ if not isinstance(api_key, str) or not api_key:
84
+ raise ValueError("Close credential api_key is required")
85
+ return Credentials(SecretString(api_key))
86
+
87
+
88
+ def new_project_connection(
89
+ project: LoadedProject, connection_name: str, http_client: httpx.AsyncClient | None = None
90
+ ) -> Connection:
91
+ if project is None:
92
+ raise ValueError("Close connection requires loaded project configuration")
93
+ reference = ConnectionRef(CONNECTOR_ID, connection_name)
94
+ reference.validate()
95
+ key = ConnectionKey(CONNECTOR_ID, connection_name)
96
+ matching = [
97
+ entry
98
+ for entry in project.configuration.connections
99
+ if entry.connector_id == CONNECTOR_ID and entry.connection_name == connection_name
100
+ ]
101
+ if len(matching) != 1:
102
+ raise ValueError("Close project connection is missing or duplicated")
103
+ if matching[0].provider != CONNECTOR_ID:
104
+ raise ValueError("Close project connection provider differs")
105
+ config = _decode_config(matching[0].configuration)
106
+ client = Client(config, _ProjectCredentialSource(project, key), http_client)
107
+ return new_connection(client, reference)
108
+
109
+ setattr(new_project_connection, '__module__', 'dex_connectors.close.connection')
110
+
111
+
112
+ def _decode_config(value: dict[str, Any]) -> Config:
113
+ if set(value) - {"baseUrl", "timeout", "maxResponseBytes"}:
114
+ raise ValueError("Close configuration has unknown fields")
115
+ config_arguments: dict[str, Any] = {}
116
+ if "baseUrl" in value:
117
+ base_url = value["baseUrl"]
118
+ if not (isinstance(base_url, str)):
119
+ raise ValueError("Close configuration baseUrl has an invalid type")
120
+ config_arguments['base_url'] = base_url
121
+ if "timeout" in value:
122
+ timeout = value["timeout"]
123
+ if not (type(timeout) is int):
124
+ raise ValueError("Close configuration timeout has an invalid type")
125
+ config_arguments['timeout_seconds'] = timeout / 1_000_000_000
126
+ if "maxResponseBytes" in value:
127
+ max_response_bytes = value["maxResponseBytes"]
128
+ if not (type(max_response_bytes) is int):
129
+ raise ValueError("Close configuration maxResponseBytes has an invalid type")
130
+ config_arguments['max_response_bytes'] = max_response_bytes
131
+ return Config(**config_arguments)
@@ -0,0 +1,57 @@
1
+ # Copyright (c) 2026 Super Durable
2
+ # SPDX-License-Identifier: MIT
3
+ # ruff: noqa
4
+
5
+ from datetime import timedelta
6
+
7
+ from dex_connectors.sdk import (
8
+ BranchDefinition,
9
+ MutationDefinition,
10
+ OperationRef,
11
+ QueryDefinition,
12
+ RetryPolicy,
13
+ StepDefaults,
14
+ default_connector_step_execute_retry_policy,
15
+ )
16
+
17
+ CONNECTOR_ID = "close"
18
+ PROVIDER = "close"
19
+ LIST_LEADS_OPERATION_ID = "listLeads"
20
+ GET_LEAD_OPERATION_ID = "getLead"
21
+ DEFECT = "defect"
22
+ FOUND = "found"
23
+ INVALID_RESPONSE = "invalidResponse"
24
+ LISTED = "listed"
25
+ NOT_FOUND = "notFound"
26
+ PROVIDER_REJECTED = "providerRejected"
27
+
28
+ LIST_LEADS_DEFINITION = QueryDefinition(
29
+ OperationRef(CONNECTOR_ID, LIST_LEADS_OPERATION_ID),
30
+ (
31
+ BranchDefinition(LISTED, "Close returned the requested data.", False),
32
+ BranchDefinition(PROVIDER_REJECTED, "Close conclusively rejected the read.", True),
33
+ BranchDefinition(INVALID_RESPONSE, "Close returned malformed or oversized JSON.", True),
34
+ BranchDefinition(DEFECT, "Local input or connection credentials are invalid.", True),
35
+ ),
36
+ StepDefaults(
37
+ timedelta(seconds=45),
38
+ 2,
39
+ execute_retry=default_connector_step_execute_retry_policy(),
40
+ ),
41
+ )
42
+
43
+ GET_LEAD_DEFINITION = QueryDefinition(
44
+ OperationRef(CONNECTOR_ID, GET_LEAD_OPERATION_ID),
45
+ (
46
+ BranchDefinition(FOUND, "Close returned the requested data.", False),
47
+ BranchDefinition(NOT_FOUND, "Close does not have the requested resource.", True),
48
+ BranchDefinition(PROVIDER_REJECTED, "Close conclusively rejected the read.", True),
49
+ BranchDefinition(INVALID_RESPONSE, "Close returned malformed or oversized JSON.", True),
50
+ BranchDefinition(DEFECT, "Local input or connection credentials are invalid.", True),
51
+ ),
52
+ StepDefaults(
53
+ timedelta(seconds=45),
54
+ 2,
55
+ execute_retry=default_connector_step_execute_retry_policy(),
56
+ ),
57
+ )