sapiopycommons 2025.7.23a659__py3-none-any.whl → 2025.7.31a664__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.
Potentially problematic release.
This version of sapiopycommons might be problematic. Click here for more details.
- sapiopycommons/ai/tool_of_tools.py +809 -0
- sapiopycommons/callbacks/callback_util.py +5 -2
- sapiopycommons/webhook/webservice_handlers.py +1 -1
- {sapiopycommons-2025.7.23a659.dist-info → sapiopycommons-2025.7.31a664.dist-info}/METADATA +1 -1
- {sapiopycommons-2025.7.23a659.dist-info → sapiopycommons-2025.7.31a664.dist-info}/RECORD +7 -33
- sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.py +0 -43
- sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.pyi +0 -31
- sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2.py +0 -123
- sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2.pyi +0 -598
- sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/proto/step_output_pb2.py +0 -45
- sapiopycommons/ai/api/plan/proto/step_output_pb2.pyi +0 -42
- sapiopycommons/ai/api/plan/proto/step_output_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/proto/step_pb2.py +0 -43
- sapiopycommons/ai/api/plan/proto/step_pb2.pyi +0 -43
- sapiopycommons/ai/api/plan/proto/step_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/script/proto/script_pb2.py +0 -55
- sapiopycommons/ai/api/plan/script/proto/script_pb2.pyi +0 -115
- sapiopycommons/ai/api/plan/script/proto/script_pb2_grpc.py +0 -153
- sapiopycommons/ai/api/plan/tool/proto/entry_pb2.py +0 -57
- sapiopycommons/ai/api/plan/tool/proto/entry_pb2.pyi +0 -96
- sapiopycommons/ai/api/plan/tool/proto/entry_pb2_grpc.py +0 -24
- sapiopycommons/ai/api/plan/tool/proto/tool_pb2.py +0 -71
- sapiopycommons/ai/api/plan/tool/proto/tool_pb2.pyi +0 -250
- sapiopycommons/ai/api/plan/tool/proto/tool_pb2_grpc.py +0 -154
- sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2.py +0 -39
- sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2.pyi +0 -32
- sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2_grpc.py +0 -24
- sapiopycommons/ai/protobuf_utils.py +0 -508
- sapiopycommons/ai/test_client.py +0 -288
- sapiopycommons/ai/tool_service_base.py +0 -916
- {sapiopycommons-2025.7.23a659.dist-info → sapiopycommons-2025.7.31a664.dist-info}/WHEEL +0 -0
- {sapiopycommons-2025.7.23a659.dist-info → sapiopycommons-2025.7.31a664.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from google.protobuf.internal import containers as _containers
|
|
2
|
-
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
3
|
-
from google.protobuf import descriptor as _descriptor
|
|
4
|
-
from google.protobuf import message as _message
|
|
5
|
-
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Optional as _Optional, Union as _Union
|
|
6
|
-
|
|
7
|
-
DESCRIPTOR: _descriptor.FileDescriptor
|
|
8
|
-
|
|
9
|
-
class SapioUserSecretTypePbo(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
10
|
-
__slots__ = ()
|
|
11
|
-
SESSION_TOKEN: _ClassVar[SapioUserSecretTypePbo]
|
|
12
|
-
PASSWORD: _ClassVar[SapioUserSecretTypePbo]
|
|
13
|
-
SESSION_TOKEN: SapioUserSecretTypePbo
|
|
14
|
-
PASSWORD: SapioUserSecretTypePbo
|
|
15
|
-
|
|
16
|
-
class SapioConnectionInfoPbo(_message.Message):
|
|
17
|
-
__slots__ = ("webservice_url", "rmi_host", "rmi_port", "app_guid", "username", "secret_type", "secret")
|
|
18
|
-
WEBSERVICE_URL_FIELD_NUMBER: _ClassVar[int]
|
|
19
|
-
RMI_HOST_FIELD_NUMBER: _ClassVar[int]
|
|
20
|
-
RMI_PORT_FIELD_NUMBER: _ClassVar[int]
|
|
21
|
-
APP_GUID_FIELD_NUMBER: _ClassVar[int]
|
|
22
|
-
USERNAME_FIELD_NUMBER: _ClassVar[int]
|
|
23
|
-
SECRET_TYPE_FIELD_NUMBER: _ClassVar[int]
|
|
24
|
-
SECRET_FIELD_NUMBER: _ClassVar[int]
|
|
25
|
-
webservice_url: str
|
|
26
|
-
rmi_host: _containers.RepeatedScalarFieldContainer[str]
|
|
27
|
-
rmi_port: int
|
|
28
|
-
app_guid: str
|
|
29
|
-
username: str
|
|
30
|
-
secret_type: SapioUserSecretTypePbo
|
|
31
|
-
secret: str
|
|
32
|
-
def __init__(self, webservice_url: _Optional[str] = ..., rmi_host: _Optional[_Iterable[str]] = ..., rmi_port: _Optional[int] = ..., app_guid: _Optional[str] = ..., username: _Optional[str] = ..., secret_type: _Optional[_Union[SapioUserSecretTypePbo, str]] = ..., secret: _Optional[str] = ...) -> None: ...
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
-
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
-
import grpc
|
|
4
|
-
import warnings
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
GRPC_GENERATED_VERSION = '1.70.0'
|
|
8
|
-
GRPC_VERSION = grpc.__version__
|
|
9
|
-
_version_not_supported = False
|
|
10
|
-
|
|
11
|
-
try:
|
|
12
|
-
from grpc._utilities import first_version_is_lower
|
|
13
|
-
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
14
|
-
except ImportError:
|
|
15
|
-
_version_not_supported = True
|
|
16
|
-
|
|
17
|
-
if _version_not_supported:
|
|
18
|
-
raise RuntimeError(
|
|
19
|
-
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
20
|
-
+ f' but the generated code in sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2_grpc.py depends on'
|
|
21
|
-
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
22
|
-
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
23
|
-
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
24
|
-
)
|
|
@@ -1,508 +0,0 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
|
|
3
|
-
from sapiopylib.rest.pojo.Sort import SortDirection
|
|
4
|
-
from sapiopylib.rest.pojo.datatype.FieldDefinition import AbstractVeloxFieldDefinition, FieldType, \
|
|
5
|
-
VeloxBooleanFieldDefinition, VeloxDateFieldDefinition, VeloxAccessionFieldDefinition, VeloxActionFieldDefinition, \
|
|
6
|
-
VeloxChildLinkFieldDefinition, VeloxDateRangeFieldDefinition, VeloxDoubleFieldDefinition, \
|
|
7
|
-
VeloxEnumFieldDefinition, VeloxIdentifierFieldDefinition, VeloxIntegerFieldDefinition, \
|
|
8
|
-
VeloxLongFieldDefinition, VeloxMultiParentFieldDefinition, VeloxParentFieldDefinition, \
|
|
9
|
-
VeloxPickListFieldDefinition, VeloxSelectionFieldDefinition, VeloxShortFieldDefinition, \
|
|
10
|
-
VeloxStringFieldDefinition, VeloxSideLinkFieldDefinition, VeloxActionStringFieldDefinition, FieldValidator, \
|
|
11
|
-
ListMode, SapioDoubleFormat, SapioStringFormat
|
|
12
|
-
|
|
13
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.fields_pb2 import FieldValuePbo
|
|
14
|
-
from sapiopycommons.ai.api.fielddefinitions.proto.velox_field_def_pb2 import FieldTypePbo, SortDirectionPbo, \
|
|
15
|
-
DoubleFormatPbo, StringFormatPbo, FieldValidatorPbo, VeloxFieldDefPbo, BooleanPropertiesPbo, DatePropertiesPbo, \
|
|
16
|
-
DoublePropertiesPbo, IntegerPropertiesPbo, LongPropertiesPbo, SelectionPropertiesPbo, StringPropertiesPbo, \
|
|
17
|
-
SideLinkPropertiesPbo, ShortPropertiesPbo, PickListPropertiesPbo, ParentLinkPropertiesPbo, MultiParentPropertiesPbo, \
|
|
18
|
-
IdentifierPropertiesPbo, FileBlobPropertiesPbo, EnumPropertiesPbo, DateRangePropertiesPbo, ChildLinkPropertiesPbo, \
|
|
19
|
-
ActionStringPropertiesPbo, ActionPropertiesPbo, AccessionPropertiesPbo, SelectionDependentFieldEntryPbo, \
|
|
20
|
-
EnumDependentFieldEntryPbo, BooleanDependentFieldEntryPbo
|
|
21
|
-
from sapiopycommons.ai.api.plan.tool.proto.entry_pb2 import DataTypePbo
|
|
22
|
-
from sapiopycommons.general.aliases import FieldValue
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# FR-47422: Created class.
|
|
26
|
-
class ProtobufUtils:
|
|
27
|
-
@staticmethod
|
|
28
|
-
def content_type_str(content_type: DataTypePbo) -> str:
|
|
29
|
-
"""
|
|
30
|
-
Convert a DataTypePbo enum to its string representation.
|
|
31
|
-
|
|
32
|
-
:param content_type: The DataTypePbo enum value.
|
|
33
|
-
:return: The string representation of the DataTypePbo.
|
|
34
|
-
"""
|
|
35
|
-
match content_type:
|
|
36
|
-
case DataTypePbo.BINARY:
|
|
37
|
-
return "binary"
|
|
38
|
-
case DataTypePbo.CSV:
|
|
39
|
-
return "csv"
|
|
40
|
-
case DataTypePbo.IMAGE:
|
|
41
|
-
return "image"
|
|
42
|
-
case DataTypePbo.JSON:
|
|
43
|
-
return "json"
|
|
44
|
-
case DataTypePbo.TEXT:
|
|
45
|
-
return "text"
|
|
46
|
-
case _:
|
|
47
|
-
raise Exception(f"Unexpected content type: {content_type}")
|
|
48
|
-
|
|
49
|
-
@staticmethod
|
|
50
|
-
def field_type_to_pbo(field_type: FieldType) -> FieldTypePbo:
|
|
51
|
-
"""
|
|
52
|
-
Convert a FieldType enum to its corresponding FieldTypePbo.
|
|
53
|
-
|
|
54
|
-
:param field_type: The FieldType enum value.
|
|
55
|
-
:return: The corresponding FieldTypePbo.
|
|
56
|
-
"""
|
|
57
|
-
match field_type:
|
|
58
|
-
case FieldType.ACTION:
|
|
59
|
-
return FieldTypePbo.ACTION
|
|
60
|
-
case FieldType.ACTION_STRING:
|
|
61
|
-
return FieldTypePbo.ACTION_STRING
|
|
62
|
-
case FieldType.AUTO_ACCESSION:
|
|
63
|
-
return FieldTypePbo.AUTO_ACCESSION
|
|
64
|
-
case FieldType.BOOLEAN:
|
|
65
|
-
return FieldTypePbo.BOOLEAN
|
|
66
|
-
case FieldType.CHILDLINK:
|
|
67
|
-
return FieldTypePbo.CHILDLINK
|
|
68
|
-
case FieldType.DATE:
|
|
69
|
-
return FieldTypePbo.DATE
|
|
70
|
-
case FieldType.DATE_RANGE:
|
|
71
|
-
return FieldTypePbo.DATE_RANGE
|
|
72
|
-
case FieldType.DOUBLE:
|
|
73
|
-
return FieldTypePbo.DOUBLE
|
|
74
|
-
case FieldType.ENUM:
|
|
75
|
-
return FieldTypePbo.ENUM
|
|
76
|
-
# case FieldType.FILE_BLOB:
|
|
77
|
-
# return FieldTypePbo.FILE_BLOB
|
|
78
|
-
case FieldType.IDENTIFIER:
|
|
79
|
-
return FieldTypePbo.IDENTIFIER
|
|
80
|
-
case FieldType.INTEGER:
|
|
81
|
-
return FieldTypePbo.INTEGER
|
|
82
|
-
case FieldType.LINK:
|
|
83
|
-
return FieldTypePbo.LINK
|
|
84
|
-
case FieldType.LONG:
|
|
85
|
-
return FieldTypePbo.LONG
|
|
86
|
-
case FieldType.MULTIPARENTLINK:
|
|
87
|
-
return FieldTypePbo.MULTIPARENTLINK
|
|
88
|
-
case FieldType.PARENTLINK:
|
|
89
|
-
return FieldTypePbo.PARENTLINK
|
|
90
|
-
case FieldType.PICKLIST:
|
|
91
|
-
return FieldTypePbo.PICKLIST
|
|
92
|
-
case FieldType.SELECTION:
|
|
93
|
-
return FieldTypePbo.SELECTION
|
|
94
|
-
case FieldType.SHORT:
|
|
95
|
-
return FieldTypePbo.SHORT
|
|
96
|
-
case FieldType.SIDE_LINK:
|
|
97
|
-
return FieldTypePbo.SIDE_LINK
|
|
98
|
-
case FieldType.STRING:
|
|
99
|
-
return FieldTypePbo.STRING
|
|
100
|
-
case _:
|
|
101
|
-
return FieldTypePbo.FIELD_TYPE_UNSPECIFIED
|
|
102
|
-
|
|
103
|
-
@staticmethod
|
|
104
|
-
def sort_direction_to_pbo(sort_direction: SortDirection | None) -> SortDirectionPbo:
|
|
105
|
-
"""
|
|
106
|
-
Convert a SortDirection enum to its corresponding SortDirectionPbo.
|
|
107
|
-
|
|
108
|
-
:param sort_direction: The SortDirection enum value.
|
|
109
|
-
:return: The corresponding SortDirectionPbo.
|
|
110
|
-
"""
|
|
111
|
-
if sort_direction is None or sort_direction == SortDirection.NONE:
|
|
112
|
-
return SortDirectionPbo.SORT_DIRECTION_NONE
|
|
113
|
-
elif sort_direction == SortDirection.ASCENDING:
|
|
114
|
-
return SortDirectionPbo.SORT_DIRECTION_ASCENDING
|
|
115
|
-
elif sort_direction == SortDirection.DESCENDING:
|
|
116
|
-
return SortDirectionPbo.SORT_DIRECTION_DESCENDING
|
|
117
|
-
else:
|
|
118
|
-
return SortDirectionPbo.SORT_DIRECTION_UNSPECIFIED
|
|
119
|
-
|
|
120
|
-
@staticmethod
|
|
121
|
-
def double_format_to_pbo(double_format: SapioDoubleFormat | None) -> DoubleFormatPbo:
|
|
122
|
-
"""
|
|
123
|
-
Convert a SapioDoubleFormat enum to its corresponding DoubleFormatPbo.
|
|
124
|
-
|
|
125
|
-
:param double_format: The SapioDoubleFormat enum value.
|
|
126
|
-
:return: The corresponding DoubleFormatPbo.
|
|
127
|
-
"""
|
|
128
|
-
if double_format is None:
|
|
129
|
-
return DoubleFormatPbo.DOUBLE_FORMAT_UNSPECIFIED
|
|
130
|
-
elif double_format == SapioDoubleFormat.CURRENCY:
|
|
131
|
-
return DoubleFormatPbo.DOUBLE_FORMAT_CURRENCY
|
|
132
|
-
elif double_format == SapioDoubleFormat.PERCENTAGE:
|
|
133
|
-
return DoubleFormatPbo.DOUBLE_FORMAT_PERCENTAGE
|
|
134
|
-
else:
|
|
135
|
-
return DoubleFormatPbo.DOUBLE_FORMAT_UNSPECIFIED
|
|
136
|
-
|
|
137
|
-
@staticmethod
|
|
138
|
-
def string_format_to_pbo(string_format: SapioStringFormat | None) -> StringFormatPbo:
|
|
139
|
-
"""
|
|
140
|
-
Convert a SapioStringFormat enum to its corresponding StringFormatPbo.
|
|
141
|
-
|
|
142
|
-
:param string_format: The SapioStringFormat enum value.
|
|
143
|
-
:return: The corresponding StringFormatPbo.
|
|
144
|
-
"""
|
|
145
|
-
if string_format is None:
|
|
146
|
-
return StringFormatPbo.STRING_FORMAT_UNSPECIFIED
|
|
147
|
-
elif string_format == SapioStringFormat.EMAIL:
|
|
148
|
-
return StringFormatPbo.STRING_FORMAT_EMAIL
|
|
149
|
-
elif string_format == SapioStringFormat.PHONE:
|
|
150
|
-
return StringFormatPbo.STRING_FORMAT_PHONE
|
|
151
|
-
else:
|
|
152
|
-
return StringFormatPbo.STRING_FORMAT_UNSPECIFIED
|
|
153
|
-
|
|
154
|
-
@staticmethod
|
|
155
|
-
def field_validator_to_pbo(validator: FieldValidator | None) -> FieldValidatorPbo | None:
|
|
156
|
-
"""
|
|
157
|
-
Convert a FieldValidator object to its corresponding FieldValidatorPbo.
|
|
158
|
-
|
|
159
|
-
:param validator: The FieldValidator object.
|
|
160
|
-
:return: The corresponding FieldValidatorPbo or None if validator is None.
|
|
161
|
-
"""
|
|
162
|
-
if validator is None:
|
|
163
|
-
return None
|
|
164
|
-
return FieldValidatorPbo(
|
|
165
|
-
validation_regex=validator.validation_regex,
|
|
166
|
-
error_message=validator.error_message
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
@staticmethod
|
|
170
|
-
def list_mode_to_str(list_mode: ListMode, field: VeloxSelectionFieldDefinition) -> str | None:
|
|
171
|
-
"""
|
|
172
|
-
Convert a ListMode enum to its string representation.
|
|
173
|
-
|
|
174
|
-
:param list_mode: The ListMode enum value.
|
|
175
|
-
:param field: The VeloxSelectionFieldDefinition object.
|
|
176
|
-
:return: The string representation of the ListMode or None if list_mode is None.
|
|
177
|
-
"""
|
|
178
|
-
if list_mode is None:
|
|
179
|
-
return None
|
|
180
|
-
list_mode_str = list_mode.list_mode_name
|
|
181
|
-
if list_mode == ListMode.LIST:
|
|
182
|
-
list_mode_str += field.pick_list_name or ""
|
|
183
|
-
elif list_mode == ListMode.PLUGIN:
|
|
184
|
-
list_mode_str += field.plugin_name or ""
|
|
185
|
-
elif list_mode == ListMode.REPORT:
|
|
186
|
-
list_mode_str += field.custom_report_name or ""
|
|
187
|
-
return list_mode_str
|
|
188
|
-
|
|
189
|
-
@staticmethod
|
|
190
|
-
def field_def_to_pbo(field: AbstractVeloxFieldDefinition) -> VeloxFieldDefPbo:
|
|
191
|
-
"""
|
|
192
|
-
Convert a AbstractVeloxFieldDefinition object to its corresponding VeloxFieldDefPbo.
|
|
193
|
-
|
|
194
|
-
:param field: The AbstractVeloxFieldDefinition object.
|
|
195
|
-
:return: The corresponding VeloxFieldDefPbo.
|
|
196
|
-
"""
|
|
197
|
-
accession_properties: AccessionPropertiesPbo | None = None
|
|
198
|
-
action_properties: ActionPropertiesPbo | None = None
|
|
199
|
-
action_string_properties: ActionStringPropertiesPbo | None = None
|
|
200
|
-
boolean_properties: BooleanPropertiesPbo | None = None
|
|
201
|
-
child_link_properties: ChildLinkPropertiesPbo | None = None
|
|
202
|
-
date_properties: DatePropertiesPbo | None = None
|
|
203
|
-
date_range_properties: DateRangePropertiesPbo | None = None
|
|
204
|
-
double_properties: DoublePropertiesPbo | None = None
|
|
205
|
-
enum_properties: EnumPropertiesPbo | None = None
|
|
206
|
-
file_blob_properties: FileBlobPropertiesPbo | None = None
|
|
207
|
-
identifier_properties: IdentifierPropertiesPbo | None = None
|
|
208
|
-
integer_properties: IntegerPropertiesPbo | None = None
|
|
209
|
-
long_properties: LongPropertiesPbo | None = None
|
|
210
|
-
multi_parent_properties: MultiParentPropertiesPbo | None = None
|
|
211
|
-
parent_link_properties: ParentLinkPropertiesPbo | None = None
|
|
212
|
-
picklist_properties: PickListPropertiesPbo | None = None
|
|
213
|
-
selection_properties: SelectionPropertiesPbo | None = None
|
|
214
|
-
short_properties: ShortPropertiesPbo | None = None
|
|
215
|
-
side_link_properties: SideLinkPropertiesPbo | None = None
|
|
216
|
-
string_properties: StringPropertiesPbo | None = None
|
|
217
|
-
|
|
218
|
-
if isinstance(field, VeloxAccessionFieldDefinition):
|
|
219
|
-
accession_properties = AccessionPropertiesPbo(
|
|
220
|
-
unique_value=field.unique_value,
|
|
221
|
-
# index_for_search # Missing in FieldDefinition.py
|
|
222
|
-
link_out=field.link_out,
|
|
223
|
-
link_out_url=field.link_out_url,
|
|
224
|
-
sequence_key=field.sequence_key,
|
|
225
|
-
prefix=field.prefix,
|
|
226
|
-
suffix=field.suffix,
|
|
227
|
-
number_of_digits=field.number_of_digits,
|
|
228
|
-
starting_value=field.starting_value
|
|
229
|
-
)
|
|
230
|
-
elif isinstance(field, VeloxActionFieldDefinition):
|
|
231
|
-
action_properties = ActionPropertiesPbo(
|
|
232
|
-
# icon_name # Missing in FieldDefinition.py
|
|
233
|
-
# icon_color # Missing in FieldDefinition.py
|
|
234
|
-
# background_color # Missing in FieldDefinition.py
|
|
235
|
-
# font_color # Missing in FieldDefinition.py
|
|
236
|
-
# action_plugin_path # Missing in FieldDefinition.py
|
|
237
|
-
)
|
|
238
|
-
elif isinstance(field, VeloxActionStringFieldDefinition):
|
|
239
|
-
action_string_properties = ActionStringPropertiesPbo(
|
|
240
|
-
default_value=field.default_value,
|
|
241
|
-
max_length=field.max_length,
|
|
242
|
-
unique_value=field.unique_value,
|
|
243
|
-
icon_name=field.icon_name,
|
|
244
|
-
action_plugin_path=field.action_plugin_path,
|
|
245
|
-
field_validator=ProtobufUtils.field_validator_to_pbo(field.field_validator),
|
|
246
|
-
direct_edit=field.direct_edit
|
|
247
|
-
)
|
|
248
|
-
elif isinstance(field, VeloxBooleanFieldDefinition):
|
|
249
|
-
boolean_properties = BooleanPropertiesPbo(
|
|
250
|
-
default_value=field.default_value,
|
|
251
|
-
is_process_todo_item=field.process_todo_item,
|
|
252
|
-
dependent_fields=[BooleanDependentFieldEntryPbo(k, v) for k, v in field.get_dependent_field_map().items()],
|
|
253
|
-
is_hide_disabled_fields=field.hide_disabled_fields
|
|
254
|
-
)
|
|
255
|
-
elif isinstance(field, VeloxChildLinkFieldDefinition):
|
|
256
|
-
child_link_properties = ChildLinkPropertiesPbo(
|
|
257
|
-
# default_value # Missing in FieldDefinition.py
|
|
258
|
-
)
|
|
259
|
-
elif isinstance(field, VeloxDateFieldDefinition):
|
|
260
|
-
date_properties = DatePropertiesPbo(
|
|
261
|
-
default_value=field.default_value,
|
|
262
|
-
static_date=field.static_date,
|
|
263
|
-
date_time_format=field.date_time_format
|
|
264
|
-
)
|
|
265
|
-
elif isinstance(field, VeloxDateRangeFieldDefinition):
|
|
266
|
-
date_range_properties = DateRangePropertiesPbo(
|
|
267
|
-
default_value=field.default_value,
|
|
268
|
-
is_static=field.static_date,
|
|
269
|
-
date_time_format=field.date_time_format
|
|
270
|
-
)
|
|
271
|
-
elif isinstance(field, VeloxDoubleFieldDefinition):
|
|
272
|
-
double_properties = DoublePropertiesPbo(
|
|
273
|
-
min_value=field.min_value,
|
|
274
|
-
max_value=field.max_value,
|
|
275
|
-
default_value=field.default_value,
|
|
276
|
-
precision=field.precision,
|
|
277
|
-
double_format=ProtobufUtils.double_format_to_pbo(field.double_format),
|
|
278
|
-
# color_ranges # Missing in FieldDefinition.py
|
|
279
|
-
)
|
|
280
|
-
# elif isinstance(field, VeloxFileBlobFieldDefinition):
|
|
281
|
-
# file_blob_properties = FileBlobPropertiesPbo()
|
|
282
|
-
elif isinstance(field, VeloxEnumFieldDefinition):
|
|
283
|
-
enum_properties = EnumPropertiesPbo(
|
|
284
|
-
default_value=field.default_value,
|
|
285
|
-
values=field.values if field.values is not None else [],
|
|
286
|
-
# color_mapping # Missing in FieldDefinition.py
|
|
287
|
-
# auto_clear_field_list # Missing in FieldDefinition.py
|
|
288
|
-
dependent_fields=[EnumDependentFieldEntryPbo(k, v) for k,v in field.get_dependent_field_map().items()],
|
|
289
|
-
is_hide_disabled_fields=field.hide_disabled_fields
|
|
290
|
-
)
|
|
291
|
-
elif isinstance(field, VeloxIdentifierFieldDefinition):
|
|
292
|
-
identifier_properties = IdentifierPropertiesPbo(
|
|
293
|
-
# default_value # Missing in FieldDefinition.py
|
|
294
|
-
)
|
|
295
|
-
elif isinstance(field, VeloxIntegerFieldDefinition):
|
|
296
|
-
integer_properties = IntegerPropertiesPbo(
|
|
297
|
-
min_value=field.min_value,
|
|
298
|
-
max_value=field.max_value,
|
|
299
|
-
default_value=field.default_value,
|
|
300
|
-
unique_value=field.unique_value,
|
|
301
|
-
# color_ranges # Missing in FieldDefinition.py
|
|
302
|
-
)
|
|
303
|
-
elif isinstance(field, VeloxLongFieldDefinition):
|
|
304
|
-
long_properties = LongPropertiesPbo(
|
|
305
|
-
min_value=field.min_value,
|
|
306
|
-
max_value=field.max_value,
|
|
307
|
-
default_value=field.default_value,
|
|
308
|
-
unique_value=field.unique_value,
|
|
309
|
-
# color_ranges # Missing in FieldDefinition.py
|
|
310
|
-
)
|
|
311
|
-
elif isinstance(field, VeloxMultiParentFieldDefinition):
|
|
312
|
-
multi_parent_properties = MultiParentPropertiesPbo()
|
|
313
|
-
elif isinstance(field, VeloxParentFieldDefinition):
|
|
314
|
-
parent_link_properties = ParentLinkPropertiesPbo(
|
|
315
|
-
# default_value # Missing in FieldDefinition.py
|
|
316
|
-
)
|
|
317
|
-
elif isinstance(field, VeloxPickListFieldDefinition):
|
|
318
|
-
picklist_properties = PickListPropertiesPbo(
|
|
319
|
-
default_value=field.default_value,
|
|
320
|
-
pick_list_name=field.pick_list_name,
|
|
321
|
-
direct_edit=field.direct_edit,
|
|
322
|
-
# link_out # Missing in FieldDefinition.py
|
|
323
|
-
# link_out_url # Missing in FieldDefinition.py
|
|
324
|
-
# index_for_search # Missing in FieldDefinition.py
|
|
325
|
-
# field_validator # Missing in FieldDefinition.py
|
|
326
|
-
# color_mapping # Missing in FieldDefinition.py
|
|
327
|
-
# auto_clear_field_list # Missing in FieldDefinition.py
|
|
328
|
-
# process_detail_map # Missing in FieldDefinition.py
|
|
329
|
-
dependent_fields=[SelectionDependentFieldEntryPbo(k, v) for k,v in field.get_dependent_field_map().items()],
|
|
330
|
-
is_hide_disabled_fields=field.hide_disabled_fields
|
|
331
|
-
)
|
|
332
|
-
elif isinstance(field, VeloxSelectionFieldDefinition):
|
|
333
|
-
list_mode_str = ProtobufUtils.list_mode_to_str(field.list_mode, field)
|
|
334
|
-
selection_properties = SelectionPropertiesPbo(
|
|
335
|
-
default_value=field.default_value,
|
|
336
|
-
list_mode=list_mode_str,
|
|
337
|
-
# auto_sort # Missing in FieldDefinition.py
|
|
338
|
-
direct_edit=field.direct_edit,
|
|
339
|
-
unique_value=field.unique_value,
|
|
340
|
-
# link_out # Missing in FieldDefinition.py
|
|
341
|
-
# link_out_url # Missing in FieldDefinition.py
|
|
342
|
-
multi_select=field.multi_select,
|
|
343
|
-
# index_for_search # Missing in FieldDefinition.py
|
|
344
|
-
# is_auto_size # Missing in FieldDefinition.py
|
|
345
|
-
# field_validator # Missing in FieldDefinition.py
|
|
346
|
-
static_list_values=field.static_list_values if field.static_list_values is not None else [],
|
|
347
|
-
# color_mapping # Missing in FieldDefinition.py
|
|
348
|
-
# auto_clear_field_list # Missing in FieldDefinition.py
|
|
349
|
-
# process_detail_map # Missing in FieldDefinition.py
|
|
350
|
-
dependent_fields=[SelectionDependentFieldEntryPbo(k, v) for k,v in field.get_dependent_field_map().items()],
|
|
351
|
-
is_hide_disabled_fields=field.hide_disabled_fields
|
|
352
|
-
)
|
|
353
|
-
elif isinstance(field, VeloxShortFieldDefinition):
|
|
354
|
-
short_properties = ShortPropertiesPbo(
|
|
355
|
-
min_value=field.min_value,
|
|
356
|
-
max_value=field.max_value,
|
|
357
|
-
default_value=field.default_value,
|
|
358
|
-
unique_value=field.unique_value,
|
|
359
|
-
# color_ranges # Missing in FieldDefinition.py
|
|
360
|
-
)
|
|
361
|
-
elif isinstance(field, VeloxSideLinkFieldDefinition):
|
|
362
|
-
side_link_properties = SideLinkPropertiesPbo(
|
|
363
|
-
linked_data_type_name=field.linked_data_type_name,
|
|
364
|
-
default_value=field.default_value,
|
|
365
|
-
# show_in_knowledge_graph # Missing in FieldDefinition.py
|
|
366
|
-
# knowledge_graph_display_name # Missing in FieldDefinition.py
|
|
367
|
-
)
|
|
368
|
-
elif isinstance(field, VeloxStringFieldDefinition):
|
|
369
|
-
string_properties = StringPropertiesPbo(
|
|
370
|
-
default_value=field.default_value,
|
|
371
|
-
max_length=field.max_length,
|
|
372
|
-
num_lines=field.num_lines,
|
|
373
|
-
unique_value=field.unique_value,
|
|
374
|
-
# index_for_search # Missing in FieldDefinition.py
|
|
375
|
-
html_editor=field.html_editor,
|
|
376
|
-
link_out=field.link_out,
|
|
377
|
-
link_out_url=field.link_out_url,
|
|
378
|
-
string_format=ProtobufUtils.string_format_to_pbo(field.string_format),
|
|
379
|
-
is_auto_size=field.auto_size,
|
|
380
|
-
field_validator=ProtobufUtils.field_validator_to_pbo(field.field_validator),
|
|
381
|
-
# preserve_padding # Missing in FieldDefinition.py
|
|
382
|
-
)
|
|
383
|
-
else:
|
|
384
|
-
print(f"Warning: Unhandled field type for properties mapping: {type(field)}")
|
|
385
|
-
|
|
386
|
-
return VeloxFieldDefPbo(
|
|
387
|
-
data_field_type=ProtobufUtils.field_type_to_pbo(field.data_field_type),
|
|
388
|
-
data_field_name=field.data_field_name,
|
|
389
|
-
display_name=field.display_name,
|
|
390
|
-
description=field.description,
|
|
391
|
-
required=field.required,
|
|
392
|
-
editable=field.editable,
|
|
393
|
-
visible=field.visible,
|
|
394
|
-
identifier=field.identifier,
|
|
395
|
-
identifier_order=field.identifier_order,
|
|
396
|
-
sort_direction=ProtobufUtils.sort_direction_to_pbo(field.sort_direction),
|
|
397
|
-
sort_order=field.sort_order,
|
|
398
|
-
tag=field.tag,
|
|
399
|
-
# approve_edit # Missing in FieldDefinition.py
|
|
400
|
-
# workflow_only_editing # Missing in FieldDefinition.py
|
|
401
|
-
# font_size # Missing in FieldDefinition.py
|
|
402
|
-
# bold_font # Missing in FieldDefinition.py
|
|
403
|
-
# italic_font # Missing in FieldDefinition.py
|
|
404
|
-
# text_decoration # Missing in FieldDefinition.py
|
|
405
|
-
is_key_field=field.key_field,
|
|
406
|
-
key_field_order=field.key_field_order,
|
|
407
|
-
# is_removable # Missing in FieldDefinition.py
|
|
408
|
-
is_system_field=field.system_field,
|
|
409
|
-
# is_restricted # Missing in FieldDefinition.py
|
|
410
|
-
is_audit_logged=field.audit_logged,
|
|
411
|
-
# is_active # Missing in FieldDefinition.py
|
|
412
|
-
# is_for_plugin_use_only # Missing in FieldDefinition.py
|
|
413
|
-
default_table_column_width=field.default_table_column_width,
|
|
414
|
-
|
|
415
|
-
accession_properties=accession_properties,
|
|
416
|
-
action_properties=action_properties,
|
|
417
|
-
action_string_properties=action_string_properties,
|
|
418
|
-
boolean_properties=boolean_properties,
|
|
419
|
-
child_link_properties=child_link_properties,
|
|
420
|
-
date_properties=date_properties,
|
|
421
|
-
date_range_properties=date_range_properties,
|
|
422
|
-
double_properties=double_properties,
|
|
423
|
-
enum_properties=enum_properties,
|
|
424
|
-
file_blob_properties=file_blob_properties,
|
|
425
|
-
identifier_properties=identifier_properties,
|
|
426
|
-
integer_properties=integer_properties,
|
|
427
|
-
long_properties=long_properties,
|
|
428
|
-
multi_parent_properties=multi_parent_properties,
|
|
429
|
-
parent_link_properties=parent_link_properties,
|
|
430
|
-
picklist_properties=picklist_properties,
|
|
431
|
-
selection_properties=selection_properties,
|
|
432
|
-
short_properties=short_properties,
|
|
433
|
-
side_link_properties=side_link_properties,
|
|
434
|
-
string_properties=string_properties,
|
|
435
|
-
)
|
|
436
|
-
|
|
437
|
-
@staticmethod
|
|
438
|
-
def field_pbo_to_value(value: FieldValuePbo) -> FieldValue:
|
|
439
|
-
"""
|
|
440
|
-
Convert a StepRecordFieldValue to its corresponding Python value.
|
|
441
|
-
|
|
442
|
-
:param value: The StepRecordFieldValue object.
|
|
443
|
-
:return: The corresponding Python value.
|
|
444
|
-
"""
|
|
445
|
-
if value.HasField("string_value"):
|
|
446
|
-
return value.string_value
|
|
447
|
-
elif value.HasField("int_value"):
|
|
448
|
-
return value.int_value
|
|
449
|
-
elif value.HasField("double_value"):
|
|
450
|
-
return value.double_value
|
|
451
|
-
elif value.HasField("bool_value"):
|
|
452
|
-
return value.bool_value
|
|
453
|
-
else:
|
|
454
|
-
return None
|
|
455
|
-
|
|
456
|
-
@staticmethod
|
|
457
|
-
def field_def_pbo_to_default_value(field_def: VeloxFieldDefPbo) -> FieldValue:
|
|
458
|
-
"""
|
|
459
|
-
Get the default value of a VeloxFieldDefPbo.
|
|
460
|
-
|
|
461
|
-
:param field_def: The VeloxFieldDefPbo object.
|
|
462
|
-
:return: The default value for the field definition.
|
|
463
|
-
"""
|
|
464
|
-
match field_def.data_field_type:
|
|
465
|
-
case FieldTypePbo.ACTION:
|
|
466
|
-
return None
|
|
467
|
-
case FieldTypePbo.ACTION_STRING:
|
|
468
|
-
return field_def.action_string_properties.default_value
|
|
469
|
-
case FieldTypePbo.AUTO_ACCESSION:
|
|
470
|
-
return None
|
|
471
|
-
case FieldTypePbo.BOOLEAN:
|
|
472
|
-
return field_def.boolean_properties.default_value
|
|
473
|
-
case FieldTypePbo.CHILDLINK:
|
|
474
|
-
return None
|
|
475
|
-
case FieldTypePbo.DATE:
|
|
476
|
-
return field_def.date_properties.default_value
|
|
477
|
-
case FieldTypePbo.DATE_RANGE:
|
|
478
|
-
return field_def.date_range_properties.default_value
|
|
479
|
-
case FieldTypePbo.DOUBLE:
|
|
480
|
-
return field_def.double_properties.default_value
|
|
481
|
-
case FieldTypePbo.ENUM:
|
|
482
|
-
return field_def.enum_properties.default_value
|
|
483
|
-
# case FieldTypePbo.FILE_BLOB:
|
|
484
|
-
# return None
|
|
485
|
-
case FieldTypePbo.IDENTIFIER:
|
|
486
|
-
return None
|
|
487
|
-
case FieldTypePbo.INTEGER:
|
|
488
|
-
return field_def.integer_properties.default_value
|
|
489
|
-
case FieldTypePbo.LINK:
|
|
490
|
-
return None
|
|
491
|
-
case FieldTypePbo.LONG:
|
|
492
|
-
return field_def.long_properties.default_value
|
|
493
|
-
case FieldTypePbo.MULTIPARENTLINK:
|
|
494
|
-
return None
|
|
495
|
-
case FieldTypePbo.PARENTLINK:
|
|
496
|
-
return None
|
|
497
|
-
case FieldTypePbo.PICKLIST:
|
|
498
|
-
return field_def.picklist_properties.default_value
|
|
499
|
-
case FieldTypePbo.SELECTION:
|
|
500
|
-
return field_def.selection_properties.default_value
|
|
501
|
-
case FieldTypePbo.SHORT:
|
|
502
|
-
return field_def.short_properties.default_value
|
|
503
|
-
case FieldTypePbo.SIDE_LINK:
|
|
504
|
-
return field_def.side_link_properties.default_value
|
|
505
|
-
case FieldTypePbo.STRING:
|
|
506
|
-
return field_def.string_properties.default_value
|
|
507
|
-
case _:
|
|
508
|
-
raise Exception(f"Unexpected field type: {field_def.data_field_type}")
|