supaflow-python-sdk 1.0.74__py3-none-any.whl

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 (44) hide show
  1. supaflow_python_sdk/__init__.py +150 -0
  2. supaflow_python_sdk/_definition_validation.py +220 -0
  3. supaflow_python_sdk/_legacy_manifest.py +89 -0
  4. supaflow_python_sdk/_legacy_naming.py +50 -0
  5. supaflow_python_sdk/_precision_json.py +74 -0
  6. supaflow_python_sdk/base_connector.py +146 -0
  7. supaflow_python_sdk/capabilities.py +74 -0
  8. supaflow_python_sdk/catalog_naming.py +189 -0
  9. supaflow_python_sdk/child_settings.py +44 -0
  10. supaflow_python_sdk/compatibility.json +10 -0
  11. supaflow_python_sdk/connector_definition.py +279 -0
  12. supaflow_python_sdk/connector_fixture.py +13 -0
  13. supaflow_python_sdk/connector_identity.py +55 -0
  14. supaflow_python_sdk/connector_property.py +97 -0
  15. supaflow_python_sdk/connector_resource.py +388 -0
  16. supaflow_python_sdk/csv_record_emitter.py +288 -0
  17. supaflow_python_sdk/cursor_candidates.py +167 -0
  18. supaflow_python_sdk/errors.py +130 -0
  19. supaflow_python_sdk/field_capabilities.py +50 -0
  20. supaflow_python_sdk/helpers.py +98 -0
  21. supaflow_python_sdk/host_api.py +102 -0
  22. supaflow_python_sdk/job_context.py +39 -0
  23. supaflow_python_sdk/jsonl_record_emitter.py +727 -0
  24. supaflow_python_sdk/keyless_object_handling.py +19 -0
  25. supaflow_python_sdk/models.py +1052 -0
  26. supaflow_python_sdk/naming.py +267 -0
  27. supaflow_python_sdk/native_mapped_jsonl_record_emitter.py +180 -0
  28. supaflow_python_sdk/oauth.py +399 -0
  29. supaflow_python_sdk/openapi_schema_builder.py +778 -0
  30. supaflow_python_sdk/property_rules.py +27 -0
  31. supaflow_python_sdk/py.typed +0 -0
  32. supaflow_python_sdk/resource_options.py +9 -0
  33. supaflow_python_sdk/schema_compliance.py +481 -0
  34. supaflow_python_sdk/source.py +165 -0
  35. supaflow_python_sdk/source_namespace.py +325 -0
  36. supaflow_python_sdk/supa_id.py +422 -0
  37. supaflow_python_sdk/temporal_stage_value.py +136 -0
  38. supaflow_python_sdk/type_inference.py +583 -0
  39. supaflow_python_sdk/ui.py +45 -0
  40. supaflow_python_sdk/write_plan.py +112 -0
  41. supaflow_python_sdk-1.0.74.dist-info/METADATA +80 -0
  42. supaflow_python_sdk-1.0.74.dist-info/RECORD +44 -0
  43. supaflow_python_sdk-1.0.74.dist-info/WHEEL +5 -0
  44. supaflow_python_sdk-1.0.74.dist-info/top_level.txt +1 -0
@@ -0,0 +1,279 @@
1
+ """Framework-neutral connector definition and legacy metadata compatibility."""
2
+ from __future__ import annotations
3
+
4
+ import copy
5
+ import functools
6
+ from dataclasses import dataclass, field
7
+ from typing import Any, ClassVar, Mapping, Sequence
8
+
9
+ from supaflow_python_sdk import _legacy_manifest as manifest_v1
10
+ from supaflow_python_sdk._definition_validation import (
11
+ _check_resource_legacy_collisions, _legacy_table_name, _validate_v11_resource,
12
+ )
13
+ from supaflow_python_sdk.capabilities import source_capabilities as default_source_capabilities
14
+ from supaflow_python_sdk.connector_identity import (
15
+ ConnectorPackageMetadata, customer_connector_type, first_party_connector_type,
16
+ is_first_party_group, parse_customer_connector_type,
17
+ )
18
+ from supaflow_python_sdk.connector_property import ConnectorProperty
19
+ from supaflow_python_sdk.connector_resource import ConnectorResource
20
+
21
+
22
+ @dataclass(frozen=True)
23
+ class ConnectorDefinition:
24
+ """Shared connector definition metadata with legacy authoring compatibility."""
25
+
26
+ # Stamped by CLI/Maven for unmigrated first-party definitions only.
27
+ _legacy_version: ClassVar[str] = "1.0.74"
28
+
29
+ name: str
30
+ type: str | None = None
31
+ entrypoint: str | None = None
32
+ description: str | None = None
33
+ icon: str | None = None
34
+ vendor: str = "dltHub"
35
+ version: str | None = None
36
+ product_version: str = "unknown"
37
+ runtime: str = "python"
38
+ sdk_version: int = 1
39
+ min_platform_version: str = "2.0.0"
40
+ kind: str = "source"
41
+ group_id: str | None = None
42
+ artifact_id: str | None = None
43
+ release_stage: str = "COMMUNITY"
44
+ capabilities: Mapping[str, Any] = field(default_factory=default_source_capabilities)
45
+ properties: Sequence[ConnectorProperty] = ()
46
+ resources: Sequence[ConnectorResource] = ()
47
+ # Opt into the normalize-backed extraction path for this connector.
48
+ #
49
+ # When True, DeclarativeDltConnector.schema() and .read() invoke dlt's
50
+ # full extract+normalize pipeline against a local filesystem destination
51
+ # and stream per-table output files into Supaflow's RecordEmitter
52
+ # (root) and child_context_infos[n].writer (each materialized child).
53
+ #
54
+ # When False (default), the connector uses the existing iterate_resource()
55
+ # streaming path. Existing connectors (Stripe, MongoDB, etc.) keep this
56
+ # default and are unaffected by 1.6a.
57
+ # API sources decode fractional JSON tokens as Decimal. Preserve their
58
+ # numeric JSON type through dlt without changing SQL/native Decimal policy.
59
+ # Internal normalization policy only; not a connector property or wire field.
60
+ exact_json_numbers: bool = field(default=False, kw_only=True)
61
+ use_full_normalize: bool = False
62
+ # Opt this connector into the JSONL planner gate. When True, schema
63
+ # discovery stamps `supaflow_python_jsonl_certified=True` on every
64
+ # ObjectMetadata's custom_attributes. The Java planner reads that key
65
+ # via @JsonNaming(SnakeCaseStrategy) and routes the connector to JSONL
66
+ # under the four-flag matrix; absent (or False) is treated as "not
67
+ # certified" and the planner falls back to CSV with reason
68
+ # LEGACY_CSV_NOT_JSONL_CERTIFIED. Connectors that have validated their
69
+ # JSONL output end-to-end (Phase 4 Task 12-style A/B) opt in here.
70
+ # Default False -- newly-routed connectors stay on CSV until they
71
+ # demonstrate parity. See
72
+ # docs/superpowers/specs/2026-05-04-jsonl-rollout-phase-2.md and
73
+ # docs/superpowers/plans/2026-05-04-jsonl-rollout-phase-2a-infrastructure.md
74
+ # (Task 1).
75
+ jsonl_certified: bool = False
76
+ # Opt this connector into original-source-name preservation through
77
+ # the dlt-backed extraction path. **TEMPORARY** -- this flag is a
78
+ # prototype-phase risk-management mechanism only. Phase 3 of the
79
+ # original-source-names plan deletes the field entirely from
80
+ # DltConnectorSpec and removes every flag-conditional branch from
81
+ # the framework; the end-state contract preserves original names
82
+ # unconditionally.
83
+ #
84
+ # When False (default), the connector flows through the legacy
85
+ # snake_case path: dlt's snake_case naming convention applies at
86
+ # extract+normalize, dlt_naming.py canonicalizes lookups, and the
87
+ # construction-time snake_case collision guards (this class's
88
+ # __post_init__ and ``_check_resource_legacy_collisions``) enforce
89
+ # that spec-author keys cannot alias under normalization.
90
+ #
91
+ # When True, the connector flows through the new contract: dlt is
92
+ # configured with ``SupaflowNamingConvention`` (case-preserving,
93
+ # ``__`` separator, no ``__``-in-segment escape), structured
94
+ # ``path_segments`` is the authoritative wire shape for derived
95
+ # children, and a defensive B2 joined-FQN guard runs at schema
96
+ # discovery (``_schema_normalize_backed``). The legacy snake_case
97
+ # collision guards are SKIPPED to avoid the construction-time
98
+ # trap: a flag=True connector with raw-distinct ``child_primary_keys``
99
+ # like ``{"Customer": ..., "customer_event": ...}`` would otherwise
100
+ # fail before the flag is even consulted at runtime.
101
+ #
102
+ # **Known gap (PR #107 review).** The schema-discovery B2 guard
103
+ # is defensive only -- it cannot catch the spec's central
104
+ # pre-merge source-shape collision (a record with both
105
+ # ``a__b`` flat AND ``a -> b`` nested) because dlt 1.24.0 has
106
+ # already merged both paths into one table by the time the
107
+ # guard reads ``data_tables()``. Real pre-normalize detection
108
+ # or escape-in-segment encoding is required before PR C flips
109
+ # the flag on Jira+Mongo. See
110
+ # ``naming.py::assert_no_path_collisions`` and the strict
111
+ # xfail in ``test_schema_normalize_backed_path_segments.py``.
112
+ #
113
+ # Set only on connectors that have been migrated to the new contract
114
+ # and have passed the orchestrator-path test suite for the new
115
+ # behavior (Jira and MongoDB in Phase 1; remaining five in Phase 2).
116
+ # See
117
+ # docs/superpowers/specs/2026-05-11-dlt-original-source-names-restoration.md.
118
+ preserve_original_names: bool = False
119
+
120
+ # New authoring inputs never shift the legacy positional constructor.
121
+ connector_name: str | None = field(default=None, kw_only=True)
122
+ connector_type: str | None = field(default=None, kw_only=True)
123
+
124
+ def _prepare_definition_inputs(self) -> None:
125
+ if self.description is None or self.icon is None:
126
+ raise TypeError("Connector definitions require description and icon")
127
+ if self.connector_name is not None:
128
+ if self.type is not None or self.connector_type is not None:
129
+ raise ValueError("Customer definitions declare only connector_name, not an explicit type")
130
+ elif self.connector_type is not None:
131
+ if self.type is not None and self.type != self.connector_type:
132
+ raise ValueError("type conflicts with connector_type")
133
+ object.__setattr__(self, "type", first_party_connector_type(self.connector_type))
134
+ elif self.type is None:
135
+ raise TypeError("Connector definitions require connector_name, connector_type or legacy type")
136
+ # An explicit entrypoint keeps the legacy construction contract. New
137
+ # definitions leave package identity to the toolchain's pyproject owner.
138
+ if self.entrypoint is not None and self.connector_name is None and self.connector_type is None:
139
+ if self.version is None:
140
+ object.__setattr__(self, "version", self._legacy_version)
141
+ if self.group_id is None:
142
+ object.__setattr__(self, "group_id", "io.supaflow")
143
+
144
+ def __init_subclass__(cls, **kwargs: Any) -> None:
145
+ super().__init_subclass__(**kwargs)
146
+ if "__post_init__" in cls.__dict__:
147
+ original = cls.__dict__["__post_init__"]
148
+
149
+ @functools.wraps(original)
150
+ def _with_definition_inputs(self, *args, **kwargs):
151
+ # Old defaults existed before custom dataclass hooks ran,
152
+ # including hooks that deliberately did not call super().
153
+ self._prepare_definition_inputs()
154
+ return original(self, *args, **kwargs)
155
+
156
+ cls.__post_init__ = _with_definition_inputs
157
+
158
+ def __post_init__(self) -> None:
159
+ self._prepare_definition_inputs()
160
+ # Legacy snake_case collision guards run only when the
161
+ # connector has NOT opted into original-name preservation.
162
+ # Under preserve_original_names=True, the runtime lookup is
163
+ # direct dict access; schema discovery runs an additional
164
+ # defensive B2 joined-FQN guard (see field docstring above
165
+ # for the documented limitation -- the guard does not catch
166
+ # pre-merge source-shape conflicts). Skipping the
167
+ # construction-time guards here avoids the trap where a
168
+ # flag=True connector with raw-distinct spec keys that
169
+ # happen to collide under snake_case would fail at spec
170
+ # instantiation before the flag is consulted at runtime.
171
+ if not self.preserve_original_names:
172
+ # Per-resource legacy collision check (was DltResourceSpec.__post_init__
173
+ # before Phase 1 sub-step 2; relocated here so it can be
174
+ # flag-gated centrally).
175
+ for resource in self.resources:
176
+ _check_resource_legacy_collisions(resource)
177
+ # Connector-scope legacy collision check: two resources whose
178
+ # names normalize to the same dlt form (``CustomerEvent`` and
179
+ # ``customer_event``) would alias at every comparison site
180
+ # routed through dlt_naming. Fail loud at spec construction.
181
+ seen: dict[str, str] = {}
182
+ for resource in self.resources:
183
+ normalized = _legacy_table_name(resource.name)
184
+ if normalized in seen and seen[normalized] != resource.name:
185
+ raise ValueError(
186
+ f"DltConnectorSpec(name={self.name!r}).resources: "
187
+ f"resource names {seen[normalized]!r} and "
188
+ f"{resource.name!r} both normalize to {normalized!r} "
189
+ f"-- runtime lookup would be ambiguous. Pick a single "
190
+ f"canonical casing."
191
+ )
192
+ seen[normalized] = resource.name
193
+ else:
194
+ # v11 closure-design structural invariants. Run per-resource:
195
+ # path_segments non-empty whenever the connector has opted
196
+ # into preservation;
197
+ # cursor_field_path_segments non-empty + consistent when
198
+ # cursor_field is set;
199
+ # primary_key_path_segments non-empty + consistent when
200
+ # primary_key is truthy.
201
+ # The legacy snake_case collision guard is skipped: under
202
+ # identity normalization, raw-distinct dict keys cannot alias.
203
+ for resource in self.resources:
204
+ _validate_v11_resource(self.name, resource)
205
+ # JSONL certification only makes sense on the normalize-backed
206
+ # read path. ``read()`` dispatches to
207
+ # ``_read_via_supaflow_destination`` purely on
208
+ # ``use_full_normalize=True`` in DeclarativeDltConnector.read(); a
209
+ # connector with ``jsonl_certified=True`` but
210
+ # ``use_full_normalize=False`` would have its catalog rows
211
+ # stamped ``supaflow_python_jsonl_certified=true`` while reads
212
+ # routed through the legacy iterate-resource path -- the Java
213
+ # planner would select JSONL but the runtime would emit CSV,
214
+ # producing a silent format-decision divergence. Fail loud at
215
+ # spec construction.
216
+ if self.jsonl_certified and not self.use_full_normalize:
217
+ raise ValueError(
218
+ f"DltConnectorSpec(name={self.name!r}): "
219
+ f"jsonl_certified=True requires use_full_normalize=True. "
220
+ f"JSONL certification is only meaningful on the "
221
+ f"normalize-backed read path (`_read_via_supaflow_destination`); "
222
+ f"with use_full_normalize=False, reads route through "
223
+ f"`iterate_resource` and emit CSV regardless of the cert "
224
+ f"stamp, producing a silent format-decision divergence "
225
+ f"between Java's planner and Python's read dispatch."
226
+ )
227
+
228
+ def artifact(self) -> str:
229
+ if self.artifact_id:
230
+ return self.artifact_id
231
+ local_name = self.connector_name if self.connector_name is not None else self.type
232
+ return f"supaflow-connector-{local_name.lower().replace('_', '-')}-python"
233
+
234
+ def with_package_metadata(self, metadata: ConnectorPackageMetadata) -> ConnectorDefinition:
235
+ """Return an isolated resolved definition without rerunning author hooks.
236
+
237
+ Metadata is supplied by the authoring reader or verified agent launch;
238
+ this pure operation performs no IO and grants no group ownership.
239
+ """
240
+ for key in ("version", "group_id", "entrypoint"):
241
+ value = getattr(metadata, key)
242
+ if not isinstance(value, str) or not value.strip():
243
+ raise ValueError(f"Package {key} must be a nonempty string")
244
+ current = getattr(self, key)
245
+ if current is not None and current != value:
246
+ raise ValueError(f"Package {key} conflicts with connector definition")
247
+ resolved_type = self.type
248
+ if self.connector_name is not None:
249
+ resolved_type = customer_connector_type(metadata.group_id, self.connector_name)
250
+ elif "__" in self.type:
251
+ group_id, _ = parse_customer_connector_type(self.type)
252
+ if group_id != metadata.group_id:
253
+ raise ValueError("Customer type conflicts with package group_id")
254
+ elif not is_first_party_group(metadata.group_id):
255
+ raise ValueError("Explicit connector type requires a first-party package group")
256
+ # replace() would rerun custom __post_init__ hooks, including hooks
257
+ # which expect the original unresolved definition. Preserve their state.
258
+ bound = copy.copy(self)
259
+ for key in ("version", "group_id", "entrypoint"):
260
+ object.__setattr__(bound, key, getattr(metadata, key))
261
+ object.__setattr__(bound, "type", resolved_type)
262
+ if self.connector_name is not None:
263
+ # Consume the authoring input into resolved identity. Keeping both
264
+ # fields would create a state rejected by the public constructor
265
+ # and break dataclasses.replace() on this immutable value.
266
+ object.__setattr__(bound, "artifact_id", self.artifact())
267
+ object.__setattr__(bound, "connector_name", None)
268
+ return bound
269
+
270
+ def resource_map(self) -> dict[str, ConnectorResource]:
271
+ return {resource.name: resource for resource in self.resources}
272
+
273
+ def manifest_dict(self) -> dict[str, Any]:
274
+ if self.type is None:
275
+ raise ValueError("Bind customer connector package metadata before generating a manifest")
276
+ return manifest_v1.manifest_dict(self)
277
+
278
+ def render_manifest_yaml(self) -> str:
279
+ return manifest_v1.render_manifest_yaml(self.manifest_dict())
@@ -0,0 +1,13 @@
1
+ """Inputs shared by connector contract tests."""
2
+ from __future__ import annotations
3
+
4
+ from dataclasses import dataclass
5
+ from typing import Any, Mapping, Sequence
6
+
7
+
8
+ @dataclass(frozen=True)
9
+ class ConnectorFixture:
10
+ """Example configuration and input records grouped by resource."""
11
+
12
+ config: Mapping[str, Any]
13
+ sample_records_by_resource: Mapping[str, Sequence[dict[str, Any]]]
@@ -0,0 +1,55 @@
1
+ """Shared resolved identity values and canonical type spelling, without IO.
2
+
3
+ Formatting is not group ownership, admission or release authority. The control
4
+ plane independently checks tenant ownership and reserved namespaces.
5
+ """
6
+ from __future__ import annotations
7
+
8
+ from dataclasses import dataclass
9
+ import re
10
+
11
+
12
+ @dataclass(frozen=True)
13
+ class ConnectorPackageMetadata:
14
+ version: str
15
+ group_id: str
16
+ entrypoint: str
17
+
18
+
19
+ _GROUP = re.compile(r"[a-z][a-z0-9]*(?:\.[a-z][a-z0-9]*)*", re.ASCII)
20
+ _TYPE = re.compile(r"[A-Z_][A-Z0-9_]*", re.ASCII)
21
+ _GROUP_SEPARATOR = "__"
22
+
23
+
24
+ def is_first_party_group(group_id: str) -> bool:
25
+ """Recognize the canonical reserved namespace, without granting ownership."""
26
+ return (isinstance(group_id, str) and _GROUP.fullmatch(group_id) is not None
27
+ and (group_id == "io.supaflow" or group_id.startswith("io.supaflow.")))
28
+
29
+
30
+ def first_party_connector_type(value: str) -> str:
31
+ """Validate an explicit canonical type; customer types retain ownership."""
32
+ if not isinstance(value, str) or _TYPE.fullmatch(value) is None or _GROUP_SEPARATOR in value:
33
+ raise ValueError("First-party connector type must be uppercase ASCII and cannot contain the reserved \"__\" separator")
34
+ return value
35
+
36
+
37
+ def customer_connector_type(group_id: str, connector_name: str) -> str:
38
+ """Derive a tenant-namespaced type from an unreserved group and bare name."""
39
+ if (not isinstance(group_id, str) or _GROUP.fullmatch(group_id) is None
40
+ or is_first_party_group(group_id)):
41
+ raise ValueError("Customer connector group must use unreserved lowercase ASCII dot-separated segments")
42
+ if not isinstance(connector_name, str) or _TYPE.fullmatch(connector_name) is None:
43
+ raise ValueError("Customer connector name must be an uppercase ASCII identifier")
44
+ return group_id.upper().replace(".", "_") + _GROUP_SEPARATOR + connector_name
45
+
46
+
47
+ def parse_customer_connector_type(value: str) -> tuple[str, str]:
48
+ """Return the original group and complete bare name from canonical spelling."""
49
+ if not isinstance(value, str):
50
+ raise ValueError("Expected a canonical group-qualified connector type")
51
+ group, delimiter, name = value.partition(_GROUP_SEPARATOR)
52
+ group_id = group.lower().replace("_", ".")
53
+ if not delimiter or customer_connector_type(group_id, name) != value:
54
+ raise ValueError("Expected a canonical group-qualified connector type")
55
+ return group_id, name
@@ -0,0 +1,97 @@
1
+ """Connector property metadata shared by authors, manifest tools and adapters."""
2
+ from __future__ import annotations
3
+
4
+ from dataclasses import dataclass, field
5
+ from typing import Any, Mapping, Sequence
6
+
7
+ from supaflow_python_sdk.property_rules import ConnectionRole, PropertyValidation
8
+
9
+
10
+ @dataclass(frozen=True)
11
+ class ConnectorProperty:
12
+ """Manifest property definition.
13
+
14
+ Mirrors the ``ConnectorManifest.PropertyDef`` shape understood by the
15
+ Java Python runtime. Optional toggles (``hidden``, ``password``,
16
+ ``read_only``, ``multi_value``) and the ``visibility`` map drive the
17
+ same UI behaviors as the corresponding fields on Java
18
+ ``@Property`` annotations.
19
+ """
20
+
21
+ name: str
22
+ label: str
23
+ description: str
24
+ type: str
25
+ required: bool = False
26
+ encrypted: bool = False
27
+ sensitive: bool = False
28
+ password: bool = False
29
+ multi_value: bool = False
30
+ read_only: bool = False
31
+ hidden: bool = False
32
+ property_group: str | None = None
33
+ display_order: int = 0
34
+ default_value: str | None = None
35
+ placeholder: str | None = None
36
+ min_value: int | None = None
37
+ max_value: int | None = None
38
+ input_type: str | None = None
39
+ code_type: str | None = None
40
+ enum_values: Sequence[str] | None = None
41
+ visibility: Mapping[str, Any] | None = None
42
+ default_value_by_role: Mapping[ConnectionRole, str] | None = None
43
+ validation_rules_by_role: Mapping[ConnectionRole, Sequence[PropertyValidation]] | None = None
44
+ resource_picker: str | None = field(default=None, kw_only=True)
45
+
46
+ def as_manifest(self) -> dict[str, Any]:
47
+ manifest = {
48
+ "name": self.name,
49
+ "label": self.label,
50
+ "description": self.description,
51
+ "type": self.type,
52
+ "required": self.required,
53
+ "display_order": self.display_order,
54
+ }
55
+ if self.encrypted:
56
+ manifest["encrypted"] = True
57
+ if self.sensitive:
58
+ manifest["sensitive"] = True
59
+ if self.password:
60
+ manifest["password"] = True
61
+ if self.multi_value:
62
+ manifest["multi_value"] = True
63
+ if self.read_only:
64
+ manifest["read_only"] = True
65
+ if self.hidden:
66
+ manifest["hidden"] = True
67
+ if self.property_group:
68
+ manifest["property_group"] = self.property_group
69
+ if self.default_value is not None:
70
+ manifest["default_value"] = self.default_value
71
+ if self.placeholder:
72
+ manifest["placeholder"] = self.placeholder
73
+ if self.min_value is not None:
74
+ manifest["min_value"] = self.min_value
75
+ if self.max_value is not None:
76
+ manifest["max_value"] = self.max_value
77
+ if self.resource_picker is not None:
78
+ manifest["resource_picker"] = self.resource_picker
79
+ if self.input_type:
80
+ manifest["input_type"] = self.input_type
81
+ if self.code_type:
82
+ manifest["code_type"] = self.code_type
83
+ if self.enum_values:
84
+ manifest["enum_values"] = list(self.enum_values)
85
+ if self.visibility:
86
+ manifest["visibility"] = dict(self.visibility)
87
+ if self.default_value_by_role:
88
+ manifest["default_value_by_role"] = {ConnectionRole(role).value: value
89
+ for role, value in self.default_value_by_role.items()}
90
+ if self.validation_rules_by_role:
91
+ if self.type != "BOOLEAN":
92
+ raise ValueError("MUST_BE_TRUE requires a BOOLEAN property")
93
+ manifest["validation_rules_by_role"] = {
94
+ ConnectionRole(role).value: [rule.as_dict() for rule in rules]
95
+ for role, rules in self.validation_rules_by_role.items()
96
+ }
97
+ return manifest