Skip to content

definition

definition

DomoWorkflow_Definition dataclass

DomoWorkflow_Definition(
    schema_version: int = 2,
    inputs: dict[str, DomoWorkflow_Parameter] = dict(),
    outputs: dict[str, DomoWorkflow_Parameter] = dict(),
    tiles: list[DomoWorkflow_Tile] = list(),
    edges: list[DomoWorkflow_Edge] = list(),
    data_list: list = list(),
    Design: DomoWorkflow_Design | None = None,
    raw: dict = dict(),
)

Parsed representation of a workflow's savedJson.

Separates designElements into typed tiles and edges, and exposes helpers for programmatic construction.

layouts property writable

layouts: list

Alias for data_list to align with Design/Tiles/Layouts terminology.

add_boolean_branch_edges

add_boolean_branch_edges(
    gateway_id: str,
    true_target_id: str,
    false_target_id: str,
    *,
    true_label: str = "True",
    false_label: str = "False",
    condition_type: str = "Basic"
) -> tuple[DomoWorkflow_Edge, DomoWorkflow_Edge]

Add the required True/False branches for a conditional gateway.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
def add_boolean_branch_edges(
    self,
    gateway_id: str,
    true_target_id: str,
    false_target_id: str,
    *,
    true_label: str = "True",
    false_label: str = "False",
    condition_type: str = "Basic",
) -> tuple[DomoWorkflow_Edge, DomoWorkflow_Edge]:
    """Add the required True/False branches for a conditional gateway."""
    self._sync_design_from_legacy_fields()
    assert self.Design is not None
    true_edge, false_edge = self.Design.add_boolean_branch_edges(
        gateway_id=gateway_id,
        true_target_id=true_target_id,
        false_target_id=false_target_id,
        true_label=true_label,
        false_label=false_label,
        condition_type=condition_type,
    )
    self._sync_legacy_fields_from_design()
    return true_edge, false_edge

add_edge

add_edge(
    source_id: str,
    target_id: str,
    title: str | None = None,
    condition_type: str | None = None,
) -> DomoWorkflow_Edge

Create and append an edge between two tile IDs.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
def add_edge(
    self,
    source_id: str,
    target_id: str,
    title: str | None = None,
    condition_type: str | None = None,
) -> DomoWorkflow_Edge:
    """Create and append an edge between two tile IDs."""
    self._sync_design_from_legacy_fields()
    assert self.Design is not None
    edge = self.Design.add_edge(
        source_id=source_id,
        target_id=target_id,
        title=title,
        condition_type=condition_type,
    )
    self._sync_legacy_fields_from_design()
    return edge

add_input

add_input(param: DomoWorkflow_Parameter) -> None

Add a parameter to the schema inputs.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
256
257
258
def add_input(self, param: DomoWorkflow_Parameter) -> None:
    """Add a parameter to the schema inputs."""
    self.inputs[param.param_name] = param

add_output

add_output(param: DomoWorkflow_Parameter) -> None

Add a parameter to the schema outputs.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
260
261
262
def add_output(self, param: DomoWorkflow_Parameter) -> None:
    """Add a parameter to the schema outputs."""
    self.outputs[param.param_name] = param

add_tile

add_tile(
    tile: DomoWorkflow_Tile,
    x: float | None = None,
    y: float | None = None,
) -> DomoWorkflow_Tile

Append a tile, auto-positioning if x/y not given (stack vertically).

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
143
144
145
146
147
148
149
150
151
152
153
154
def add_tile(
    self,
    tile: DomoWorkflow_Tile,
    x: float | None = None,
    y: float | None = None,
) -> DomoWorkflow_Tile:
    """Append a tile, auto-positioning if x/y not given (stack vertically)."""
    self._sync_design_from_legacy_fields()
    assert self.Design is not None
    tile = self.Design.add_tile(tile=tile, x=x, y=y)
    self._sync_legacy_fields_from_design()
    return tile

empty classmethod

Create an empty definition suitable for a brand-new workflow.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
332
333
334
335
@classmethod
def empty(cls) -> DomoWorkflow_Definition:
    """Create an empty definition suitable for a brand-new workflow."""
    return cls()

from_saved_json classmethod

from_saved_json(
    saved_json_str: str,
) -> DomoWorkflow_Definition

Parse the savedJson string stored on a version object.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
78
79
80
81
82
@classmethod
def from_saved_json(cls, saved_json_str: str) -> DomoWorkflow_Definition:
    """Parse the savedJson string stored on a version object."""
    raw = json.loads(saved_json_str)
    return cls._from_raw(raw)

get_connection_validation_errors

get_connection_validation_errors(
    *,
    logic_tile_types: tuple[str, ...] = (
        "conditionalGatewayNode",
    ),
    allow_dangling_tile_types: tuple[str, ...] = (
        "endNode",
    ),
    required_logic_outputs: int = 2
) -> list[str]

Return graph-connection validation errors without raising.

Rules: - Only tiles in allow_dangling_tile_types may have zero outgoing edges. - Tiles in logic_tile_types must have exactly required_logic_outputs outgoing edges. - Edges must reference existing source/target tile IDs.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
def get_connection_validation_errors(
    self,
    *,
    logic_tile_types: tuple[str, ...] = ("conditionalGatewayNode",),
    allow_dangling_tile_types: tuple[str, ...] = ("endNode",),
    required_logic_outputs: int = 2,
) -> list[str]:
    """Return graph-connection validation errors without raising.

    Rules:
    - Only tiles in ``allow_dangling_tile_types`` may have zero outgoing edges.
    - Tiles in ``logic_tile_types`` must have exactly ``required_logic_outputs``
      outgoing edges.
    - Edges must reference existing source/target tile IDs.
    """
    self._sync_design_from_legacy_fields()
    assert self.Design is not None
    return self.Design.get_connection_validation_errors(
        logic_tile_types=logic_tile_types,
        allow_dangling_tile_types=allow_dangling_tile_types,
        required_logic_outputs=required_logic_outputs,
    )

set_guarded_codeengine_flow

set_guarded_codeengine_flow(
    *,
    package_id: str,
    package_version: str,
    success_functions: list[str],
    failure_notification_emails: list[str] | None = None,
    inputs_by_function: (
        dict[str, list[DomoWorkflow_Parameter]] | None
    ) = None,
    start_title: str = "Start",
    end_title: str = "End",
    notification_title: str = "Notify Owners",
    notification_message: str = "Workflow preflight failed",
    start_x: float = 80.0,
    start_y: float = 80.0,
    y_step: float = 150.0
) -> None

Build a guarded workflow graph via Design manager.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
def set_guarded_codeengine_flow(
    self,
    *,
    package_id: str,
    package_version: str,
    success_functions: list[str],
    failure_notification_emails: list[str] | None = None,
    inputs_by_function: dict[str, list[DomoWorkflow_Parameter]] | None = None,
    start_title: str = "Start",
    end_title: str = "End",
    notification_title: str = "Notify Owners",
    notification_message: str = "Workflow preflight failed",
    start_x: float = 80.0,
    start_y: float = 80.0,
    y_step: float = 150.0,
) -> None:
    """Build a guarded workflow graph via Design manager."""
    self._sync_design_from_legacy_fields()
    assert self.Design is not None
    self.Design.set_guarded_codeengine_flow(
        package_id=package_id,
        package_version=package_version,
        success_functions=success_functions,
        failure_notification_emails=failure_notification_emails,
        inputs_by_function=inputs_by_function,
        start_title=start_title,
        end_title=end_title,
        notification_title=notification_title,
        notification_message=notification_message,
        start_x=start_x,
        start_y=start_y,
        y_step=y_step,
    )
    self._sync_legacy_fields_from_design()

set_linear_codeengine_flow

set_linear_codeengine_flow(
    *,
    package_id: str,
    package_version: str,
    function_names: list[str],
    inputs_by_function: (
        dict[str, list[DomoWorkflow_Parameter]] | None
    ) = None,
    start_title: str = "Start",
    end_title: str = "End",
    start_x: float = 80.0,
    start_y: float = 80.0,
    y_step: float = 150.0
) -> None

Replace current graph with a linear CodeEngine flow via Design manager.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
def set_linear_codeengine_flow(
    self,
    *,
    package_id: str,
    package_version: str,
    function_names: list[str],
    inputs_by_function: dict[str, list[DomoWorkflow_Parameter]] | None = None,
    start_title: str = "Start",
    end_title: str = "End",
    start_x: float = 80.0,
    start_y: float = 80.0,
    y_step: float = 150.0,
) -> None:
    """Replace current graph with a linear CodeEngine flow via Design manager."""
    self._sync_design_from_legacy_fields()
    assert self.Design is not None
    self.Design.set_linear_codeengine_flow(
        package_id=package_id,
        package_version=package_version,
        function_names=function_names,
        inputs_by_function=inputs_by_function,
        start_title=start_title,
        end_title=end_title,
        start_x=start_x,
        start_y=start_y,
        y_step=y_step,
    )
    self._sync_legacy_fields_from_design()

to_saved_json

to_saved_json() -> str

Serialize back to the savedJson string expected by the API.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
def to_saved_json(self) -> str:
    """Serialize back to the savedJson string expected by the API."""
    self._sync_design_from_legacy_fields()
    design_payload = (
        self.Design.to_dict()
        if self.Design is not None
        else {
            "version": self.schema_version,
            "dataList": self.data_list,
            "designElements": [t.to_dict() for t in self.tiles]
            + [e.to_dict() for e in self.edges],
        }
    )
    payload = {
        "schema": {
            "inputs": {k: v.to_dict() for k, v in self.inputs.items()},
            "outputs": {k: v.to_dict() for k, v in self.outputs.items()},
        },
        "version": design_payload["version"],
        "dataList": design_payload["dataList"],
        "designElements": design_payload["designElements"],
    }
    return json.dumps(payload)

validate_boolean_conditionals

validate_boolean_conditionals(
    required_labels: tuple[str, str] | None = None,
) -> None

Raise if any conditional gateway does not have a complete two-branch split.

If required_labels is provided, the gateway must have exactly those two branch labels. If it is omitted, the gateway only needs two distinct, non-empty condition edges.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
199
200
201
202
203
204
205
206
207
208
209
210
211
def validate_boolean_conditionals(
    self,
    required_labels: tuple[str, str] | None = None,
) -> None:
    """Raise if any conditional gateway does not have a complete two-branch split.

    If `required_labels` is provided, the gateway must have exactly those two
    branch labels. If it is omitted, the gateway only needs two distinct,
    non-empty condition edges.
    """
    self._sync_design_from_legacy_fields()
    assert self.Design is not None
    self.Design.validate_boolean_conditionals(required_labels=required_labels)

validate_connection_rules

validate_connection_rules(
    *,
    logic_tile_types: tuple[str, ...] = (
        "conditionalGatewayNode",
    ),
    allow_dangling_tile_types: tuple[str, ...] = (
        "endNode",
    ),
    required_logic_outputs: int = 2
) -> None

Raise when connection rules are violated.

This is a stricter topological check than validate_boolean_conditionals and is intended to answer whether the workflow graph is structurally valid.

Source code in src/crew_dcs/classes/DomoWorkflow/definition.py
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
def validate_connection_rules(
    self,
    *,
    logic_tile_types: tuple[str, ...] = ("conditionalGatewayNode",),
    allow_dangling_tile_types: tuple[str, ...] = ("endNode",),
    required_logic_outputs: int = 2,
) -> None:
    """Raise when connection rules are violated.

    This is a stricter topological check than ``validate_boolean_conditionals``
    and is intended to answer whether the workflow graph is structurally valid.
    """
    self._sync_design_from_legacy_fields()
    assert self.Design is not None
    self.Design.validate_connection_rules(
        logic_tile_types=logic_tile_types,
        allow_dangling_tile_types=allow_dangling_tile_types,
        required_logic_outputs=required_logic_outputs,
    )