code0-hercules 1.3.0__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.
- code0_hercules-1.3.0.dist-info/METADATA +79 -0
- code0_hercules-1.3.0.dist-info/RECORD +258 -0
- code0_hercules-1.3.0.dist-info/WHEEL +5 -0
- code0_hercules-1.3.0.dist-info/entry_points.txt +2 -0
- code0_hercules-1.3.0.dist-info/top_level.txt +1 -0
- hercules/__init__.py +81 -0
- hercules/_metadata.py +38 -0
- hercules/_tsgen/convert.mjs +96 -0
- hercules/_tsgen/package-lock.json +366 -0
- hercules/_tsgen/package.json +11 -0
- hercules/_tucana/__init__.py +29 -0
- hercules/_tucana/helpers.py +73 -0
- hercules/action.py +345 -0
- hercules/actions/__init__.py +21 -0
- hercules/actions/execution.py +121 -0
- hercules/actions/flow_execution.py +11 -0
- hercules/actions/flow_update.py +18 -0
- hercules/actions/module_configurations.py +14 -0
- hercules/actions/sub_flow_execution.py +14 -0
- hercules/cli.py +137 -0
- hercules/decorators/__init__.py +0 -0
- hercules/decorators/datatype.py +39 -0
- hercules/decorators/event.py +35 -0
- hercules/decorators/function.py +59 -0
- hercules/decorators/meta.py +82 -0
- hercules/decorators/runtime_event.py +15 -0
- hercules/decorators/runtime_function.py +18 -0
- hercules/definitions/__init__.py +162 -0
- hercules/definitions/cron_action/__init__.py +0 -0
- hercules/definitions/cron_action/data_types/__init__.py +0 -0
- hercules/definitions/cron_action/data_types/cron_day_of_month.py +11 -0
- hercules/definitions/cron_action/data_types/cron_day_of_week.py +11 -0
- hercules/definitions/cron_action/data_types/cron_hour.py +11 -0
- hercules/definitions/cron_action/data_types/cron_minute.py +11 -0
- hercules/definitions/cron_action/data_types/cron_month.py +11 -0
- hercules/definitions/cron_action/runtime_flow_types/__init__.py +0 -0
- hercules/definitions/cron_action/runtime_flow_types/cron.py +19 -0
- hercules/definitions/rest_action/__init__.py +0 -0
- hercules/definitions/rest_action/data_types/__init__.py +0 -0
- hercules/definitions/rest_action/data_types/rest_adapter_input.py +19 -0
- hercules/definitions/rest_action/data_types/rest_auth_type.py +19 -0
- hercules/definitions/rest_action/data_types/rest_auth_value.py +11 -0
- hercules/definitions/rest_action/runtime_flow_types/__init__.py +0 -0
- hercules/definitions/rest_action/runtime_flow_types/rest.py +20 -0
- hercules/definitions/rest_action/runtime_functions/__init__.py +0 -0
- hercules/definitions/rest_action/runtime_functions/rest_control_respond.py +21 -0
- hercules/definitions/taurus_boolean/__init__.py +0 -0
- hercules/definitions/taurus_boolean/data_types/__init__.py +0 -0
- hercules/definitions/taurus_boolean/data_types/boolean.py +11 -0
- hercules/definitions/taurus_boolean/runtime_functions/__init__.py +0 -0
- hercules/definitions/taurus_boolean/runtime_functions/std_boolean_as_number.py +18 -0
- hercules/definitions/taurus_boolean/runtime_functions/std_boolean_as_text.py +18 -0
- hercules/definitions/taurus_boolean/runtime_functions/std_boolean_from_number.py +18 -0
- hercules/definitions/taurus_boolean/runtime_functions/std_boolean_from_text.py +18 -0
- hercules/definitions/taurus_boolean/runtime_functions/std_boolean_is_equal.py +19 -0
- hercules/definitions/taurus_boolean/runtime_functions/std_boolean_negate.py +18 -0
- hercules/definitions/taurus_color/__init__.py +0 -0
- hercules/definitions/taurus_color/data_types/__init__.py +0 -0
- hercules/definitions/taurus_color/data_types/color.py +17 -0
- hercules/definitions/taurus_color/runtime_functions/__init__.py +0 -0
- hercules/definitions/taurus_color/runtime_functions/std_color_as_hex.py +18 -0
- hercules/definitions/taurus_color/runtime_functions/std_color_as_hsl.py +18 -0
- hercules/definitions/taurus_color/runtime_functions/std_color_as_rgb.py +18 -0
- hercules/definitions/taurus_color/runtime_functions/std_color_from_hex.py +18 -0
- hercules/definitions/taurus_color/runtime_functions/std_color_from_hsl.py +21 -0
- hercules/definitions/taurus_color/runtime_functions/std_color_from_rgb.py +21 -0
- hercules/definitions/taurus_control/__init__.py +0 -0
- hercules/definitions/taurus_control/data_types/__init__.py +0 -0
- hercules/definitions/taurus_control/data_types/comparator.py +21 -0
- hercules/definitions/taurus_control/data_types/consumer.py +20 -0
- hercules/definitions/taurus_control/data_types/predicate.py +20 -0
- hercules/definitions/taurus_control/data_types/runnable.py +13 -0
- hercules/definitions/taurus_control/data_types/transform.py +20 -0
- hercules/definitions/taurus_control/runtime_functions/__init__.py +0 -0
- hercules/definitions/taurus_control/runtime_functions/std_control_if.py +19 -0
- hercules/definitions/taurus_control/runtime_functions/std_control_if_else.py +21 -0
- hercules/definitions/taurus_control/runtime_functions/std_control_return.py +18 -0
- hercules/definitions/taurus_control/runtime_functions/std_control_stop.py +16 -0
- hercules/definitions/taurus_control/runtime_functions/std_control_value.py +18 -0
- hercules/definitions/taurus_date/__init__.py +0 -0
- hercules/definitions/taurus_date/data_types/__init__.py +0 -0
- hercules/definitions/taurus_date/data_types/date.py +11 -0
- hercules/definitions/taurus_date/data_types/hour.py +11 -0
- hercules/definitions/taurus_date/data_types/minute.py +11 -0
- hercules/definitions/taurus_date/data_types/month.py +22 -0
- hercules/definitions/taurus_date/runtime_functions/__init__.py +0 -0
- hercules/definitions/taurus_date/runtime_functions/std_date_format.py +20 -0
- hercules/definitions/taurus_date/runtime_functions/std_date_from.py +24 -0
- hercules/definitions/taurus_date/runtime_functions/std_date_from_text.py +19 -0
- hercules/definitions/taurus_date/runtime_functions/std_date_from_unix.py +18 -0
- hercules/definitions/taurus_date/runtime_functions/std_date_now.py +16 -0
- hercules/definitions/taurus_file/__init__.py +0 -0
- hercules/definitions/taurus_file/data_types/__init__.py +0 -0
- hercules/definitions/taurus_file/data_types/file.py +19 -0
- hercules/definitions/taurus_file/runtime_functions/__init__.py +0 -0
- hercules/definitions/taurus_file/runtime_functions/std_file_size.py +18 -0
- hercules/definitions/taurus_http/__init__.py +0 -0
- hercules/definitions/taurus_http/data_types/__init__.py +0 -0
- hercules/definitions/taurus_http/data_types/http_auth_place.py +12 -0
- hercules/definitions/taurus_http/data_types/http_auth_type.py +17 -0
- hercules/definitions/taurus_http/data_types/http_auth_value.py +11 -0
- hercules/definitions/taurus_http/data_types/http_method.py +16 -0
- hercules/definitions/taurus_http/data_types/http_payload.py +11 -0
- hercules/definitions/taurus_http/data_types/http_request.py +19 -0
- hercules/definitions/taurus_http/data_types/http_response.py +18 -0
- hercules/definitions/taurus_http/data_types/http_schema.py +31 -0
- hercules/definitions/taurus_http/data_types/http_status_code.py +13 -0
- hercules/definitions/taurus_http/data_types/http_url.py +13 -0
- hercules/definitions/taurus_http/runtime_functions/__init__.py +0 -0
- hercules/definitions/taurus_http/runtime_functions/http_request_send.py +26 -0
- hercules/definitions/taurus_list/__init__.py +0 -0
- hercules/definitions/taurus_list/data_types/__init__.py +0 -0
- hercules/definitions/taurus_list/data_types/list.py +13 -0
- hercules/definitions/taurus_list/runtime_functions/__init__.py +0 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_at.py +20 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_concat.py +20 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_filter.py +19 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_find.py +20 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_find_index.py +19 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_find_last.py +20 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_first.py +18 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_flat.py +18 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_for_each.py +19 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_index_of.py +19 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_is_empty.py +18 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_join.py +19 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_last.py +18 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_map.py +19 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_max.py +18 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_min.py +18 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_pop.py +18 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_push.py +19 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_remove.py +19 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_reverse.py +18 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_size.py +18 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_sort.py +19 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_sort_reverse.py +19 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_sum.py +18 -0
- hercules/definitions/taurus_list/runtime_functions/std_list_to_unique.py +18 -0
- hercules/definitions/taurus_number/__init__.py +0 -0
- hercules/definitions/taurus_number/data_types/__init__.py +0 -0
- hercules/definitions/taurus_number/data_types/number.py +11 -0
- hercules/definitions/taurus_number/runtime_functions/__init__.py +0 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_abs.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_add.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_arccos.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_arcsin.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_arctan.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_as_text.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_clamp.py +20 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_cos.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_cosh.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_divide.py +20 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_euler.py +16 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_exponential.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_from_text.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_has_digits.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_is_equal.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_is_greater.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_is_less.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_is_positive.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_is_zero.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_ln.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_log.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_max.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_min.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_modulo.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_multiply.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_negate.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_pi.py +16 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_random_number.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_remove_digits.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_root.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_round.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_round_down.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_round_up.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_sin.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_sinh.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_square.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_square_root.py +18 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_subtract.py +19 -0
- hercules/definitions/taurus_number/runtime_functions/std_number_tan.py +18 -0
- hercules/definitions/taurus_object/__init__.py +0 -0
- hercules/definitions/taurus_object/data_types/__init__.py +0 -0
- hercules/definitions/taurus_object/data_types/object.py +13 -0
- hercules/definitions/taurus_object/data_types/type.py +13 -0
- hercules/definitions/taurus_object/runtime_functions/__init__.py +0 -0
- hercules/definitions/taurus_object/runtime_functions/std_object_contains_key.py +19 -0
- hercules/definitions/taurus_object/runtime_functions/std_object_get.py +19 -0
- hercules/definitions/taurus_object/runtime_functions/std_object_keys.py +18 -0
- hercules/definitions/taurus_object/runtime_functions/std_object_set.py +20 -0
- hercules/definitions/taurus_object/runtime_functions/std_object_size.py +18 -0
- hercules/definitions/taurus_text/__init__.py +0 -0
- hercules/definitions/taurus_text/data_types/__init__.py +0 -0
- hercules/definitions/taurus_text/data_types/text.py +11 -0
- hercules/definitions/taurus_text/data_types/text_encoding.py +13 -0
- hercules/definitions/taurus_text/runtime_functions/__init__.py +0 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_append.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_as_bytes.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_at.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_byte_size.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_capitalize.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_chars.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_contains.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_decode.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_encode.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_ends_with.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_from_ascii.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_hex.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_index_of.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_insert.py +20 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_is_equal.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_length.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_lowercase.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_octal.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_prepend.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_remove.py +20 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_replace.py +20 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_replace_first.py +21 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_replace_last.py +20 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_reverse.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_split.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_starts_with.py +19 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_swapcase.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_to_ascii.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_trim.py +18 -0
- hercules/definitions/taurus_text/runtime_functions/std_text_uppercase.py +18 -0
- hercules/events.py +23 -0
- hercules/internal/__init__.py +0 -0
- hercules/internal/connection.py +37 -0
- hercules/internal/literal.py +113 -0
- hercules/internal/module_builder.py +261 -0
- hercules/internal/pydantic_codegen.py +82 -0
- hercules/internal/schema.py +158 -0
- hercules/internal/tsgen.py +93 -0
- hercules/manager/__init__.py +0 -0
- hercules/manager/base.py +73 -0
- hercules/manager/config.py +45 -0
- hercules/manager/datatype.py +8 -0
- hercules/manager/event.py +8 -0
- hercules/manager/flow.py +12 -0
- hercules/manager/function.py +8 -0
- hercules/manager/runtime_event.py +8 -0
- hercules/manager/runtime_function.py +8 -0
- hercules/map/__init__.py +0 -0
- hercules/map/datatype.py +41 -0
- hercules/map/event.py +74 -0
- hercules/map/function.py +76 -0
- hercules/map/runtime_event.py +43 -0
- hercules/map/runtime_function.py +64 -0
- hercules/models/__init__.py +0 -0
- hercules/models/datatype.py +49 -0
- hercules/models/event.py +35 -0
- hercules/models/function.py +37 -0
- hercules/models/runtime_event.py +29 -0
- hercules/models/runtime_function.py +33 -0
- hercules/schema.py +38 -0
- hercules/types.py +88 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Data type decorators (port of ``src/decorators/datatype.dec.ts``)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import Type
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel
|
|
7
|
+
|
|
8
|
+
from hercules._metadata import define_metadata
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def Schema_(schema: Type[BaseModel]):
|
|
12
|
+
"""Attach the Pydantic model that describes a data type's shape."""
|
|
13
|
+
|
|
14
|
+
def decorator(target):
|
|
15
|
+
define_metadata("hercules:schema", schema, target)
|
|
16
|
+
return target
|
|
17
|
+
|
|
18
|
+
return decorator
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def TypeString(type_string: str):
|
|
22
|
+
"""Emit an explicit TypeScript type string for a data type, verbatim.
|
|
23
|
+
|
|
24
|
+
Used by the generated built-in definitions to preserve cross-data-type
|
|
25
|
+
identifier references exactly. User-authored data types normally omit this
|
|
26
|
+
and let the type be derived from the ``@Schema`` Pydantic model.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def decorator(target):
|
|
30
|
+
define_metadata("hercules:type_string", type_string, target)
|
|
31
|
+
return target
|
|
32
|
+
|
|
33
|
+
return decorator
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# Exported under the name ``Schema`` to match the TypeScript decorator.
|
|
37
|
+
Schema = Schema_ # type: ignore[assignment]
|
|
38
|
+
|
|
39
|
+
__all__ = ["Schema", "TypeString"]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Event decorators (port of ``src/decorators/event.dec.ts``)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import Union
|
|
5
|
+
|
|
6
|
+
from hercules._metadata import define_metadata, get_own_metadata
|
|
7
|
+
from hercules.decorators.meta import normalize_translations
|
|
8
|
+
from hercules.models.event import EventSettingProps
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _coerce_setting(setting: Union[EventSettingProps, dict]) -> EventSettingProps:
|
|
12
|
+
if isinstance(setting, EventSettingProps):
|
|
13
|
+
return setting
|
|
14
|
+
data = dict(setting)
|
|
15
|
+
for key in ("name", "description"):
|
|
16
|
+
if data.get(key) is not None:
|
|
17
|
+
data[key] = normalize_translations(data[key])
|
|
18
|
+
return EventSettingProps(**data)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def EventSetting(setting: Union[EventSettingProps, dict]):
|
|
22
|
+
coerced = _coerce_setting(setting)
|
|
23
|
+
|
|
24
|
+
def decorator(target):
|
|
25
|
+
# get_own_metadata: getMetadata would return the parent class's array on
|
|
26
|
+
# subclasses, and inserting would mutate the parent's settings.
|
|
27
|
+
settings = get_own_metadata("hercules:flow_settings", target) or []
|
|
28
|
+
settings.insert(0, coerced)
|
|
29
|
+
define_metadata("hercules:flow_settings", settings, target)
|
|
30
|
+
return target
|
|
31
|
+
|
|
32
|
+
return decorator
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
__all__ = ["EventSetting"]
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Function decorators (port of ``src/decorators/function.dec.ts``)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import Union
|
|
5
|
+
|
|
6
|
+
from hercules._metadata import define_metadata, get_own_metadata
|
|
7
|
+
from hercules.decorators.meta import normalize_translations
|
|
8
|
+
from hercules.models.function import FunctionParameterProps
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def OmitFunction():
|
|
12
|
+
def decorator(target):
|
|
13
|
+
define_metadata("hercules:omit_function_definition", True, target)
|
|
14
|
+
return target
|
|
15
|
+
|
|
16
|
+
return decorator
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def Design(design: str):
|
|
20
|
+
def decorator(target):
|
|
21
|
+
define_metadata("hercules:design", design, target)
|
|
22
|
+
return target
|
|
23
|
+
|
|
24
|
+
return decorator
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def ThrowsError(throws_error: bool = True):
|
|
28
|
+
def decorator(target):
|
|
29
|
+
define_metadata("hercules:throws_error", throws_error, target)
|
|
30
|
+
return target
|
|
31
|
+
|
|
32
|
+
return decorator
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _coerce_parameter(parameter: Union[FunctionParameterProps, dict]) -> FunctionParameterProps:
|
|
36
|
+
if isinstance(parameter, FunctionParameterProps):
|
|
37
|
+
return parameter
|
|
38
|
+
param = dict(parameter)
|
|
39
|
+
for key in ("name", "description", "documentation"):
|
|
40
|
+
if param.get(key) is not None:
|
|
41
|
+
param[key] = normalize_translations(param[key])
|
|
42
|
+
return FunctionParameterProps(**param)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def Parameter(parameter: Union[FunctionParameterProps, dict]):
|
|
46
|
+
coerced = _coerce_parameter(parameter)
|
|
47
|
+
|
|
48
|
+
def decorator(target):
|
|
49
|
+
# get_own_metadata: getMetadata would return the parent class's array on
|
|
50
|
+
# subclasses, and inserting would mutate the parent's parameters.
|
|
51
|
+
parameters = get_own_metadata("hercules:function_parameters", target) or []
|
|
52
|
+
parameters.insert(0, coerced)
|
|
53
|
+
define_metadata("hercules:function_parameters", parameters, target)
|
|
54
|
+
return target
|
|
55
|
+
|
|
56
|
+
return decorator
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
__all__ = ["OmitFunction", "Design", "ThrowsError", "Parameter"]
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""Meta decorators (port of ``src/decorators/meta.dec.ts``).
|
|
2
|
+
|
|
3
|
+
Each decorator attaches class metadata under a ``hercules:*`` key, mirroring the
|
|
4
|
+
TypeScript ``reflect-metadata`` usage. Translation arguments accept either
|
|
5
|
+
:class:`~hercules.types.Translation` instances or ``{"code", "content"}`` dicts.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import List, Union
|
|
10
|
+
|
|
11
|
+
from hercules._metadata import define_metadata
|
|
12
|
+
from hercules.types import Translation
|
|
13
|
+
|
|
14
|
+
TranslationLike = Union[Translation, dict]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def normalize_translations(items) -> List[Translation]:
|
|
18
|
+
result: List[Translation] = []
|
|
19
|
+
for item in items:
|
|
20
|
+
if isinstance(item, Translation):
|
|
21
|
+
result.append(item)
|
|
22
|
+
elif isinstance(item, dict):
|
|
23
|
+
result.append(Translation(code=item["code"], content=item["content"]))
|
|
24
|
+
else:
|
|
25
|
+
raise TypeError(f"Invalid translation: {item!r}")
|
|
26
|
+
return result
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _meta(key: str):
|
|
30
|
+
def decorator_factory(*translations: TranslationLike):
|
|
31
|
+
normalized = normalize_translations(translations)
|
|
32
|
+
|
|
33
|
+
def decorator(target):
|
|
34
|
+
define_metadata(key, normalized, target)
|
|
35
|
+
return target
|
|
36
|
+
|
|
37
|
+
return decorator
|
|
38
|
+
|
|
39
|
+
return decorator_factory
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Identifier = lambda id: _define_simple("hercules:identifier", id) # noqa: E731
|
|
43
|
+
Signature = lambda signature: _define_simple("hercules:signature", signature) # noqa: E731
|
|
44
|
+
DisplayIcon = lambda display_icon: _define_simple("hercules:display_icon", display_icon) # noqa: E731
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _define_simple(key: str, value):
|
|
48
|
+
def decorator(target):
|
|
49
|
+
define_metadata(key, value, target)
|
|
50
|
+
return target
|
|
51
|
+
|
|
52
|
+
return decorator
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def Editable(editable: bool = True):
|
|
56
|
+
def decorator(target):
|
|
57
|
+
define_metadata("hercules:editable", editable, target)
|
|
58
|
+
return target
|
|
59
|
+
|
|
60
|
+
return decorator
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
Name = _meta("hercules:name")
|
|
64
|
+
Description = _meta("hercules:description")
|
|
65
|
+
Documentation = _meta("hercules:documentation")
|
|
66
|
+
DisplayMessage = _meta("hercules:display_message")
|
|
67
|
+
Alias = _meta("hercules:alias")
|
|
68
|
+
DeprecationMessage = _meta("hercules:deprecation_message")
|
|
69
|
+
|
|
70
|
+
__all__ = [
|
|
71
|
+
"Identifier",
|
|
72
|
+
"Name",
|
|
73
|
+
"Description",
|
|
74
|
+
"Documentation",
|
|
75
|
+
"DisplayMessage",
|
|
76
|
+
"Alias",
|
|
77
|
+
"DeprecationMessage",
|
|
78
|
+
"Signature",
|
|
79
|
+
"DisplayIcon",
|
|
80
|
+
"Editable",
|
|
81
|
+
"normalize_translations",
|
|
82
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Runtime event decorators (port of ``src/decorators/runtime_event.dec.ts``)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from hercules._metadata import define_metadata
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def OmitEvent():
|
|
8
|
+
def decorator(target):
|
|
9
|
+
define_metadata("hercules:omit_event_definition", True, target)
|
|
10
|
+
return target
|
|
11
|
+
|
|
12
|
+
return decorator
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
__all__ = ["OmitEvent"]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Runtime function decorators.
|
|
2
|
+
|
|
3
|
+
Port of ``src/decorators/runtime_function.dec.ts``.
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from hercules._metadata import define_metadata
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def OmitRuntimeFunction():
|
|
11
|
+
def decorator(target):
|
|
12
|
+
define_metadata("hercules:omit_function_definition", True, target)
|
|
13
|
+
return target
|
|
14
|
+
|
|
15
|
+
return decorator
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
__all__ = ["OmitRuntimeFunction"]
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import hercules.definitions.cron_action.data_types.cron_day_of_month # noqa: F401
|
|
2
|
+
import hercules.definitions.cron_action.data_types.cron_day_of_week # noqa: F401
|
|
3
|
+
import hercules.definitions.cron_action.data_types.cron_hour # noqa: F401
|
|
4
|
+
import hercules.definitions.cron_action.data_types.cron_minute # noqa: F401
|
|
5
|
+
import hercules.definitions.cron_action.data_types.cron_month # noqa: F401
|
|
6
|
+
import hercules.definitions.cron_action.runtime_flow_types.cron # noqa: F401
|
|
7
|
+
import hercules.definitions.rest_action.data_types.rest_adapter_input # noqa: F401
|
|
8
|
+
import hercules.definitions.rest_action.data_types.rest_auth_type # noqa: F401
|
|
9
|
+
import hercules.definitions.rest_action.data_types.rest_auth_value # noqa: F401
|
|
10
|
+
import hercules.definitions.rest_action.runtime_flow_types.rest # noqa: F401
|
|
11
|
+
import hercules.definitions.rest_action.runtime_functions.rest_control_respond # noqa: F401
|
|
12
|
+
import hercules.definitions.taurus_boolean.data_types.boolean # noqa: F401
|
|
13
|
+
import hercules.definitions.taurus_boolean.runtime_functions.std_boolean_as_number # noqa: F401
|
|
14
|
+
import hercules.definitions.taurus_boolean.runtime_functions.std_boolean_as_text # noqa: F401
|
|
15
|
+
import hercules.definitions.taurus_boolean.runtime_functions.std_boolean_from_number # noqa: F401
|
|
16
|
+
import hercules.definitions.taurus_boolean.runtime_functions.std_boolean_from_text # noqa: F401
|
|
17
|
+
import hercules.definitions.taurus_boolean.runtime_functions.std_boolean_is_equal # noqa: F401
|
|
18
|
+
import hercules.definitions.taurus_boolean.runtime_functions.std_boolean_negate # noqa: F401
|
|
19
|
+
import hercules.definitions.taurus_color.data_types.color # noqa: F401
|
|
20
|
+
import hercules.definitions.taurus_color.runtime_functions.std_color_as_hex # noqa: F401
|
|
21
|
+
import hercules.definitions.taurus_color.runtime_functions.std_color_as_hsl # noqa: F401
|
|
22
|
+
import hercules.definitions.taurus_color.runtime_functions.std_color_as_rgb # noqa: F401
|
|
23
|
+
import hercules.definitions.taurus_color.runtime_functions.std_color_from_hex # noqa: F401
|
|
24
|
+
import hercules.definitions.taurus_color.runtime_functions.std_color_from_hsl # noqa: F401
|
|
25
|
+
import hercules.definitions.taurus_color.runtime_functions.std_color_from_rgb # noqa: F401
|
|
26
|
+
import hercules.definitions.taurus_control.data_types.comparator # noqa: F401
|
|
27
|
+
import hercules.definitions.taurus_control.data_types.consumer # noqa: F401
|
|
28
|
+
import hercules.definitions.taurus_control.data_types.predicate # noqa: F401
|
|
29
|
+
import hercules.definitions.taurus_control.data_types.runnable # noqa: F401
|
|
30
|
+
import hercules.definitions.taurus_control.data_types.transform # noqa: F401
|
|
31
|
+
import hercules.definitions.taurus_control.runtime_functions.std_control_if # noqa: F401
|
|
32
|
+
import hercules.definitions.taurus_control.runtime_functions.std_control_if_else # noqa: F401
|
|
33
|
+
import hercules.definitions.taurus_control.runtime_functions.std_control_return # noqa: F401
|
|
34
|
+
import hercules.definitions.taurus_control.runtime_functions.std_control_stop # noqa: F401
|
|
35
|
+
import hercules.definitions.taurus_control.runtime_functions.std_control_value # noqa: F401
|
|
36
|
+
import hercules.definitions.taurus_date.data_types.date # noqa: F401
|
|
37
|
+
import hercules.definitions.taurus_date.data_types.hour # noqa: F401
|
|
38
|
+
import hercules.definitions.taurus_date.data_types.minute # noqa: F401
|
|
39
|
+
import hercules.definitions.taurus_date.data_types.month # noqa: F401
|
|
40
|
+
import hercules.definitions.taurus_date.runtime_functions.std_date_format # noqa: F401
|
|
41
|
+
import hercules.definitions.taurus_date.runtime_functions.std_date_from # noqa: F401
|
|
42
|
+
import hercules.definitions.taurus_date.runtime_functions.std_date_from_text # noqa: F401
|
|
43
|
+
import hercules.definitions.taurus_date.runtime_functions.std_date_from_unix # noqa: F401
|
|
44
|
+
import hercules.definitions.taurus_date.runtime_functions.std_date_now # noqa: F401
|
|
45
|
+
import hercules.definitions.taurus_file.data_types.file # noqa: F401
|
|
46
|
+
import hercules.definitions.taurus_file.runtime_functions.std_file_size # noqa: F401
|
|
47
|
+
import hercules.definitions.taurus_http.data_types.http_auth_place # noqa: F401
|
|
48
|
+
import hercules.definitions.taurus_http.data_types.http_auth_type # noqa: F401
|
|
49
|
+
import hercules.definitions.taurus_http.data_types.http_auth_value # noqa: F401
|
|
50
|
+
import hercules.definitions.taurus_http.data_types.http_method # noqa: F401
|
|
51
|
+
import hercules.definitions.taurus_http.data_types.http_payload # noqa: F401
|
|
52
|
+
import hercules.definitions.taurus_http.data_types.http_request # noqa: F401
|
|
53
|
+
import hercules.definitions.taurus_http.data_types.http_response # noqa: F401
|
|
54
|
+
import hercules.definitions.taurus_http.data_types.http_schema # noqa: F401
|
|
55
|
+
import hercules.definitions.taurus_http.data_types.http_status_code # noqa: F401
|
|
56
|
+
import hercules.definitions.taurus_http.data_types.http_url # noqa: F401
|
|
57
|
+
import hercules.definitions.taurus_http.runtime_functions.http_request_send # noqa: F401
|
|
58
|
+
import hercules.definitions.taurus_list.data_types.list # noqa: F401
|
|
59
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_at # noqa: F401
|
|
60
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_concat # noqa: F401
|
|
61
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_filter # noqa: F401
|
|
62
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_find # noqa: F401
|
|
63
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_find_index # noqa: F401
|
|
64
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_find_last # noqa: F401
|
|
65
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_first # noqa: F401
|
|
66
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_flat # noqa: F401
|
|
67
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_for_each # noqa: F401
|
|
68
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_index_of # noqa: F401
|
|
69
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_is_empty # noqa: F401
|
|
70
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_join # noqa: F401
|
|
71
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_last # noqa: F401
|
|
72
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_map # noqa: F401
|
|
73
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_max # noqa: F401
|
|
74
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_min # noqa: F401
|
|
75
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_pop # noqa: F401
|
|
76
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_push # noqa: F401
|
|
77
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_remove # noqa: F401
|
|
78
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_reverse # noqa: F401
|
|
79
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_size # noqa: F401
|
|
80
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_sort # noqa: F401
|
|
81
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_sort_reverse # noqa: F401
|
|
82
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_sum # noqa: F401
|
|
83
|
+
import hercules.definitions.taurus_list.runtime_functions.std_list_to_unique # noqa: F401
|
|
84
|
+
import hercules.definitions.taurus_number.data_types.number # noqa: F401
|
|
85
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_abs # noqa: F401
|
|
86
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_add # noqa: F401
|
|
87
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_arccos # noqa: F401
|
|
88
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_arcsin # noqa: F401
|
|
89
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_arctan # noqa: F401
|
|
90
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_as_text # noqa: F401
|
|
91
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_clamp # noqa: F401
|
|
92
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_cos # noqa: F401
|
|
93
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_cosh # noqa: F401
|
|
94
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_divide # noqa: F401
|
|
95
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_euler # noqa: F401
|
|
96
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_exponential # noqa: F401
|
|
97
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_from_text # noqa: F401
|
|
98
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_has_digits # noqa: F401
|
|
99
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_is_equal # noqa: F401
|
|
100
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_is_greater # noqa: F401
|
|
101
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_is_less # noqa: F401
|
|
102
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_is_positive # noqa: F401
|
|
103
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_is_zero # noqa: F401
|
|
104
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_ln # noqa: F401
|
|
105
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_log # noqa: F401
|
|
106
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_max # noqa: F401
|
|
107
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_min # noqa: F401
|
|
108
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_modulo # noqa: F401
|
|
109
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_multiply # noqa: F401
|
|
110
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_negate # noqa: F401
|
|
111
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_pi # noqa: F401
|
|
112
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_random_number # noqa: F401
|
|
113
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_remove_digits # noqa: F401
|
|
114
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_root # noqa: F401
|
|
115
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_round # noqa: F401
|
|
116
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_round_down # noqa: F401
|
|
117
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_round_up # noqa: F401
|
|
118
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_sin # noqa: F401
|
|
119
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_sinh # noqa: F401
|
|
120
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_square # noqa: F401
|
|
121
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_square_root # noqa: F401
|
|
122
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_subtract # noqa: F401
|
|
123
|
+
import hercules.definitions.taurus_number.runtime_functions.std_number_tan # noqa: F401
|
|
124
|
+
import hercules.definitions.taurus_object.data_types.object # noqa: F401
|
|
125
|
+
import hercules.definitions.taurus_object.data_types.type # noqa: F401
|
|
126
|
+
import hercules.definitions.taurus_object.runtime_functions.std_object_contains_key # noqa: F401
|
|
127
|
+
import hercules.definitions.taurus_object.runtime_functions.std_object_get # noqa: F401
|
|
128
|
+
import hercules.definitions.taurus_object.runtime_functions.std_object_keys # noqa: F401
|
|
129
|
+
import hercules.definitions.taurus_object.runtime_functions.std_object_set # noqa: F401
|
|
130
|
+
import hercules.definitions.taurus_object.runtime_functions.std_object_size # noqa: F401
|
|
131
|
+
import hercules.definitions.taurus_text.data_types.text # noqa: F401
|
|
132
|
+
import hercules.definitions.taurus_text.data_types.text_encoding # noqa: F401
|
|
133
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_append # noqa: F401
|
|
134
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_as_bytes # noqa: F401
|
|
135
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_at # noqa: F401
|
|
136
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_byte_size # noqa: F401
|
|
137
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_capitalize # noqa: F401
|
|
138
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_chars # noqa: F401
|
|
139
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_contains # noqa: F401
|
|
140
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_decode # noqa: F401
|
|
141
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_encode # noqa: F401
|
|
142
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_ends_with # noqa: F401
|
|
143
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_from_ascii # noqa: F401
|
|
144
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_hex # noqa: F401
|
|
145
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_index_of # noqa: F401
|
|
146
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_insert # noqa: F401
|
|
147
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_is_equal # noqa: F401
|
|
148
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_length # noqa: F401
|
|
149
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_lowercase # noqa: F401
|
|
150
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_octal # noqa: F401
|
|
151
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_prepend # noqa: F401
|
|
152
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_remove # noqa: F401
|
|
153
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_replace # noqa: F401
|
|
154
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_replace_first # noqa: F401
|
|
155
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_replace_last # noqa: F401
|
|
156
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_reverse # noqa: F401
|
|
157
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_split # noqa: F401
|
|
158
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_starts_with # noqa: F401
|
|
159
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_swapcase # noqa: F401
|
|
160
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_to_ascii # noqa: F401
|
|
161
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_trim # noqa: F401
|
|
162
|
+
import hercules.definitions.taurus_text.runtime_functions.std_text_uppercase # noqa: F401
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from hercules.models.runtime_event import RuntimeEventRunnable
|
|
2
|
+
from hercules.decorators.meta import Alias, Description, DisplayIcon, DisplayMessage, Identifier, Name, Signature
|
|
3
|
+
from hercules.decorators.event import EventSetting
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@Identifier("CRON")
|
|
7
|
+
@Signature("(cron_minute: CRON_MINUTE, cron_hour: CRON_HOUR, cron_day_of_month: CRON_DAY_OF_MONTH, cron_month: CRON_MONTH, cron_day_of_week: CRON_DAY_OF_WEEK): void")
|
|
8
|
+
@Name({"code": "en-US", "content": "Cron Job"})
|
|
9
|
+
@Description({"code": "en-US", "content": "A Cron Job is a scheduled task that runs automatically at specified intervals, typically defined using cron expressions. It is commonly used to automate repetitive operations such as data processing, system maintenance, and periodic updates without requiring manual execution."})
|
|
10
|
+
@DisplayMessage({"code": "en-US", "content": "Runs flow every ${cron_minute}min ${cron_hour}hour ${cron_day_of_month}day of month ${cron_month}month ${cron_day_of_week}day of week"})
|
|
11
|
+
@Alias({"code": "en-US", "content": "cron;code;schedule;timer;clock;flow"})
|
|
12
|
+
@DisplayIcon("tabler:file-time")
|
|
13
|
+
@EventSetting({"identifier": "cron_minute", "name": [{"code": "en-US", "content": "Minute"}], "description": [{"code": "en-US", "content": "Defines the minute when the flow runs (e.g., 0 for on the hour, */5 for every 5 minutes)."}]})
|
|
14
|
+
@EventSetting({"identifier": "cron_hour", "name": [{"code": "en-US", "content": "Hour"}], "description": [{"code": "en-US", "content": "Defines the hour when the flow runs (e.g., 0 for midnight, 14 for 2 PM)."}]})
|
|
15
|
+
@EventSetting({"identifier": "cron_day_of_month", "name": [{"code": "en-US", "content": "Day of the Month"}], "description": [{"code": "en-US", "content": "Defines the day of the month when the flow runs (e.g., 1 for first day, 15 for mid-month)."}]})
|
|
16
|
+
@EventSetting({"identifier": "cron_month", "name": [{"code": "en-US", "content": "Month"}], "description": [{"code": "en-US", "content": "Defines the month when the flow runs (e.g., 1 for January, 12 for December)."}]})
|
|
17
|
+
@EventSetting({"identifier": "cron_day_of_week", "name": [{"code": "en-US", "content": "Day of the Week"}], "description": [{"code": "en-US", "content": "Defines the weekday when the flow runs (e.g., 0 or SUN for Sunday, MON-FRI for weekdays)."}]})
|
|
18
|
+
class Cron(RuntimeEventRunnable):
|
|
19
|
+
pass
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, ConfigDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RestAdapterInput(BaseModel):
|
|
9
|
+
model_config = ConfigDict(
|
|
10
|
+
extra='forbid',
|
|
11
|
+
)
|
|
12
|
+
payload: Any
|
|
13
|
+
headers: Any
|
|
14
|
+
query_params: Any
|
|
15
|
+
path_params: Any
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
from hercules.internal.schema import register_schema
|
|
19
|
+
register_schema(RestAdapterInput, "REST_ADAPTER_INPUT")
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import RootModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RestAuthType(
|
|
9
|
+
RootModel[
|
|
10
|
+
Literal['Bearer JWT'] | Literal['Bearer static'] | Literal['Basic'] | Any | None
|
|
11
|
+
]
|
|
12
|
+
):
|
|
13
|
+
root: (
|
|
14
|
+
Literal['Bearer JWT'] | Literal['Bearer static'] | Literal['Basic'] | Any | None
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
from hercules.internal.schema import register_schema
|
|
19
|
+
register_schema(RestAuthType, "REST_AUTH_TYPE")
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from hercules.models.runtime_event import RuntimeEventRunnable
|
|
2
|
+
from hercules.decorators.meta import Alias, Description, DisplayIcon, DisplayMessage, Identifier, Name, Signature
|
|
3
|
+
from hercules.decorators.event import EventSetting
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@Identifier("REST")
|
|
7
|
+
@Signature("<A extends REST_AUTH_TYPE, T>(http_schema: HTTP_SCHEMA, http_url: HTTP_URL, http_method: HTTP_METHOD, http_auth: A, http_auth_value: REST_AUTH_VALUE<A>, input_schema: TYPE<T>): REST_ADAPTER_INPUT<T>")
|
|
8
|
+
@Name({"code": "en-US", "content": "Webhook"})
|
|
9
|
+
@Description({"code": "en-US", "content": "A Webhook is an HTTP endpoint that listens for incoming requests from external services or clients, allowing you to react to events in real time using standard HTTP methods like GET, POST, PUT, and DELETE."})
|
|
10
|
+
@DisplayMessage({"code": "en-US", "content": "Webhook on ${http_method} at ${http_url}"})
|
|
11
|
+
@Alias({"code": "en-US", "content": "webhook;http;rest;route;web"})
|
|
12
|
+
@DisplayIcon("tabler:world-www")
|
|
13
|
+
@EventSetting({"identifier": "http_schema", "name": [{"code": "en-US", "content": "Content Type"}], "description": [{"code": "en-US", "content": "Specifies the MIME type of the incoming request payload, such as application/json, application/xml, or text/plain. This determines the expected format of the payload parameter."}]})
|
|
14
|
+
@EventSetting({"identifier": "http_url", "unique": "PROJECT", "name": [{"code": "en-US", "content": "URL"}], "description": [{"code": "en-US", "content": "Specifies the HTTP URL endpoint."}]})
|
|
15
|
+
@EventSetting({"identifier": "http_method", "name": [{"code": "en-US", "content": "Method"}], "description": [{"code": "en-US", "content": "Specifies the HTTP request method (e.g., GET, POST, PUT, DELETE)."}]})
|
|
16
|
+
@EventSetting({"identifier": "http_auth", "name": [{"code": "en-US", "content": "Authentication type"}], "description": [{"code": "en-US", "content": "Specifies the authentication mechanism used for the incoming Webhook request (e.g., Bearer JWT, Bearer static, Basic)."}], "optional": True})
|
|
17
|
+
@EventSetting({"identifier": "http_auth_value", "name": [{"code": "en-US", "content": "Authentication value"}], "description": [{"code": "en-US", "content": "Provides the credential value matching the selected authentication type (e.g., token string or username/password pair)."}], "optional": True})
|
|
18
|
+
@EventSetting({"identifier": "input_schema", "name": [{"code": "en-US", "content": "Input schema"}], "description": [{"code": "en-US", "content": "Input schema which defines the expected structure of the incoming request data."}], "optional": True})
|
|
19
|
+
class Rest(RuntimeEventRunnable):
|
|
20
|
+
pass
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from hercules.models.runtime_function import RuntimeFunctionRunnable
|
|
2
|
+
from hercules.decorators.meta import Alias, Description, DisplayIcon, DisplayMessage, Identifier, Name, Signature
|
|
3
|
+
from hercules.decorators.runtime_function import OmitRuntimeFunction
|
|
4
|
+
from hercules.decorators.function import Parameter
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@OmitRuntimeFunction()
|
|
8
|
+
@Identifier("rest::control::respond")
|
|
9
|
+
@Signature("<S extends HTTP_SCHEMA>(http_status_code: HTTP_STATUS_CODE, http_schema: S, payload: HTTP_PAYLOAD<S>, headers?: OBJECT<{}>): void")
|
|
10
|
+
@Name({"code": "en-US", "content": "Respond"})
|
|
11
|
+
@Description({"code": "en-US", "content": "Processes an HTTP response and returns it to the requesting client. This function typically completes the HTTP request\u2013response cycle by delivering the server\u2019s final output, such as headers, status codes, and body content, back to the client."})
|
|
12
|
+
@DisplayMessage({"code": "en-US", "content": "Sends response with status ${http_status_code} and payload ${payload}"})
|
|
13
|
+
@Alias({"code": "en-US", "content": "respond;control;http"})
|
|
14
|
+
@DisplayIcon("tabler:cube-send")
|
|
15
|
+
@Parameter({"runtime_name": "http_status_code", "name": [{"code": "en-US", "content": "HTTP Status Code"}], "description": [{"code": "en-US", "content": "An HTTP status code is a three-digit number (100\u2013599) indicating the result of a request (e.g., 200, 404, 500)."}]})
|
|
16
|
+
@Parameter({"runtime_name": "http_schema", "name": [{"code": "en-US", "content": "Content Type"}], "description": [{"code": "en-US", "content": "Specifies the MIME type of the response payload, such as application/json, application/xml, or text/plain. This determines the expected format of the payload parameter."}]})
|
|
17
|
+
@Parameter({"runtime_name": "payload", "name": [{"code": "en-US", "content": "Response Payload"}], "description": [{"code": "en-US", "content": "Contains the response payload. For application/json the value must be an OBJECT, for all other content types a plain string is expected."}]})
|
|
18
|
+
@Parameter({"runtime_name": "headers", "name": [{"code": "en-US", "content": "HTTP response headers"}], "description": [{"code": "en-US", "content": "A collection of key-value pairs containing additional response metadata."}], "optional": True})
|
|
19
|
+
class RestControlRespond(RuntimeFunctionRunnable):
|
|
20
|
+
def run(self, *args):
|
|
21
|
+
raise NotImplementedError("RestControlRespond.run() is not implemented")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|