amsdal 0.5.34__cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.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.
- amsdal/Third-Party Materials - AMSDAL Dependencies - License Notices.md +1362 -0
- amsdal/__about__.py +4 -0
- amsdal/__about__.pyi +1 -0
- amsdal/__init__.py +23 -0
- amsdal/__init__.pyi +9 -0
- amsdal/__migrations__/0000_initial.py +36 -0
- amsdal/__migrations__/0001_create_class_file.py +61 -0
- amsdal/__migrations__/0002_create_class_file.py +109 -0
- amsdal/__migrations__/0003_update_class_file.py +91 -0
- amsdal/__migrations__/0004_update_class_file.py +45 -0
- amsdal/cloud/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/__init__.pyi +0 -0
- amsdal/cloud/client.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/client.pyi +57 -0
- amsdal/cloud/constants.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/constants.pyi +13 -0
- amsdal/cloud/enums.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/enums.pyi +68 -0
- amsdal/cloud/models/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/models/__init__.pyi +0 -0
- amsdal/cloud/models/base.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/models/base.pyi +247 -0
- amsdal/cloud/services/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/__init__.pyi +0 -0
- amsdal/cloud/services/actions/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/__init__.pyi +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.pyi +19 -0
- amsdal/cloud/services/actions/add_basic_auth.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_basic_auth.pyi +21 -0
- amsdal/cloud/services/actions/add_dependency.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_dependency.pyi +19 -0
- amsdal/cloud/services/actions/add_secret.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_secret.pyi +20 -0
- amsdal/cloud/services/actions/base.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/base.pyi +122 -0
- amsdal/cloud/services/actions/create_deploy.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_deploy.pyi +41 -0
- amsdal/cloud/services/actions/create_env.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_env.pyi +19 -0
- amsdal/cloud/services/actions/create_session.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_session.pyi +17 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.pyi +19 -0
- amsdal/cloud/services/actions/delete_basic_auth.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_basic_auth.pyi +20 -0
- amsdal/cloud/services/actions/delete_dependency.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_dependency.pyi +21 -0
- amsdal/cloud/services/actions/delete_env.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_env.pyi +21 -0
- amsdal/cloud/services/actions/delete_secret.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_secret.pyi +21 -0
- amsdal/cloud/services/actions/destroy_deploy.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/destroy_deploy.pyi +18 -0
- amsdal/cloud/services/actions/expose_db.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/expose_db.pyi +22 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.pyi +21 -0
- amsdal/cloud/services/actions/get_monitoring_info.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/get_monitoring_info.pyi +21 -0
- amsdal/cloud/services/actions/list_dependencies.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_dependencies.pyi +21 -0
- amsdal/cloud/services/actions/list_deploys.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_deploys.pyi +19 -0
- amsdal/cloud/services/actions/list_envs.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_envs.pyi +20 -0
- amsdal/cloud/services/actions/list_secrets.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_secrets.pyi +22 -0
- amsdal/cloud/services/actions/manager.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/manager.pyi +278 -0
- amsdal/cloud/services/actions/signup_action.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/signup_action.pyi +20 -0
- amsdal/cloud/services/actions/update_deploy.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/update_deploy.pyi +19 -0
- amsdal/cloud/services/auth/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/__init__.pyi +0 -0
- amsdal/cloud/services/auth/base.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/base.pyi +6 -0
- amsdal/cloud/services/auth/credentials.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/credentials.pyi +30 -0
- amsdal/cloud/services/auth/manager.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/manager.pyi +26 -0
- amsdal/cloud/services/auth/signup_service.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/signup_service.pyi +32 -0
- amsdal/cloud/services/auth/token.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/token.pyi +27 -0
- amsdal/configs/__init__.py +0 -0
- amsdal/configs/__init__.pyi +0 -0
- amsdal/configs/constants.py +33 -0
- amsdal/configs/constants.pyi +22 -0
- amsdal/configs/main.py +274 -0
- amsdal/configs/main.pyi +178 -0
- amsdal/context/__init__.py +0 -0
- amsdal/context/__init__.pyi +0 -0
- amsdal/context/manager.py +69 -0
- amsdal/context/manager.pyi +50 -0
- amsdal/contrib/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/contrib/__init__.pyi +0 -0
- amsdal/contrib/app_config.py +7 -0
- amsdal/contrib/app_config.pyi +6 -0
- amsdal/contrib/auth/__init__.py +0 -0
- amsdal/contrib/auth/__init__.pyi +0 -0
- amsdal/contrib/auth/app.py +27 -0
- amsdal/contrib/auth/app.pyi +15 -0
- amsdal/contrib/auth/decorators/__init__.py +35 -0
- amsdal/contrib/auth/decorators/__init__.pyi +6 -0
- amsdal/contrib/auth/errors.py +43 -0
- amsdal/contrib/auth/errors.pyi +16 -0
- amsdal/contrib/auth/fixtures/basic_permissions.json +64 -0
- amsdal/contrib/auth/lifecycle/__init__.py +0 -0
- amsdal/contrib/auth/lifecycle/__init__.pyi +0 -0
- amsdal/contrib/auth/lifecycle/consumer.py +394 -0
- amsdal/contrib/auth/lifecycle/consumer.pyi +108 -0
- amsdal/contrib/auth/migrations/0000_initial.py +87 -0
- amsdal/contrib/auth/migrations/0001_add_mfa_support.py +188 -0
- amsdal/contrib/auth/models/__init__.py +1 -0
- amsdal/contrib/auth/models/backup_code.py +85 -0
- amsdal/contrib/auth/models/email_mfa_device.py +108 -0
- amsdal/contrib/auth/models/login_session.py +235 -0
- amsdal/contrib/auth/models/mfa_device.py +86 -0
- amsdal/contrib/auth/models/permission.py +23 -0
- amsdal/contrib/auth/models/sms_device.py +113 -0
- amsdal/contrib/auth/models/totp_device.py +58 -0
- amsdal/contrib/auth/models/user.py +156 -0
- amsdal/contrib/auth/services/__init__.py +1 -0
- amsdal/contrib/auth/services/__init__.pyi +0 -0
- amsdal/contrib/auth/services/mfa_device_service.py +544 -0
- amsdal/contrib/auth/services/mfa_device_service.pyi +216 -0
- amsdal/contrib/auth/services/totp_service.py +358 -0
- amsdal/contrib/auth/services/totp_service.pyi +158 -0
- amsdal/contrib/auth/settings.py +44 -0
- amsdal/contrib/auth/settings.pyi +34 -0
- amsdal/contrib/auth/transactions/__init__.py +1 -0
- amsdal/contrib/auth/transactions/__init__.pyi +0 -0
- amsdal/contrib/auth/transactions/mfa_device_transactions.py +458 -0
- amsdal/contrib/auth/transactions/mfa_device_transactions.pyi +226 -0
- amsdal/contrib/auth/transactions/totp_transactions.py +203 -0
- amsdal/contrib/auth/transactions/totp_transactions.pyi +113 -0
- amsdal/contrib/auth/utils/__init__.py +0 -0
- amsdal/contrib/auth/utils/__init__.pyi +0 -0
- amsdal/contrib/auth/utils/mfa.py +257 -0
- amsdal/contrib/auth/utils/mfa.pyi +119 -0
- amsdal/contrib/frontend_configs/__init__.py +0 -0
- amsdal/contrib/frontend_configs/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/app.py +24 -0
- amsdal/contrib/frontend_configs/app.pyi +19 -0
- amsdal/contrib/frontend_configs/constants.py +1 -0
- amsdal/contrib/frontend_configs/constants.pyi +1 -0
- amsdal/contrib/frontend_configs/conversion/__init__.py +5 -0
- amsdal/contrib/frontend_configs/conversion/__init__.pyi +3 -0
- amsdal/contrib/frontend_configs/conversion/convert.py +310 -0
- amsdal/contrib/frontend_configs/conversion/convert.pyi +22 -0
- amsdal/contrib/frontend_configs/lifecycle/__init__.py +0 -0
- amsdal/contrib/frontend_configs/lifecycle/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/lifecycle/consumer.py +306 -0
- amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +98 -0
- amsdal/contrib/frontend_configs/migrations/0000_initial.py +227 -0
- amsdal/contrib/frontend_configs/migrations/0001_update_frontend_control_config.py +245 -0
- amsdal/contrib/frontend_configs/migrations/0002_add_button_and_invoke_actions.py +352 -0
- amsdal/contrib/frontend_configs/migrations/0003_create_class_frontendconfigdashboardelement.py +145 -0
- amsdal/contrib/frontend_configs/models/__init__.py +0 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +110 -0
- amsdal/contrib/frontend_configs/models/frontend_config_dashboard.py +51 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.py +110 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
- amsdal/contrib/frontend_configs/utils.py +29 -0
- amsdal/contrib/frontend_configs/utils.pyi +17 -0
- amsdal/errors.py +31 -0
- amsdal/errors.pyi +12 -0
- amsdal/fixtures/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/__init__.pyi +0 -0
- amsdal/fixtures/manager.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/manager.pyi +170 -0
- amsdal/fixtures/utils.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/utils.pyi +9 -0
- amsdal/manager.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/manager.pyi +265 -0
- amsdal/mixins/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/__init__.pyi +0 -0
- amsdal/mixins/class_versions_mixin.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/class_versions_mixin.pyi +12 -0
- amsdal/models/__init__.py +19 -0
- amsdal/models/core/__init__.py +0 -0
- amsdal/models/core/class_object.py +38 -0
- amsdal/models/core/class_property.py +26 -0
- amsdal/models/core/file.py +243 -0
- amsdal/models/core/fixture.py +25 -0
- amsdal/models/core/option.py +11 -0
- amsdal/models/core/storage_metadata.py +15 -0
- amsdal/models/core/validator.py +12 -0
- amsdal/models/mixins.py +31 -0
- amsdal/models/types/__init__.py +0 -0
- amsdal/models/types/object.py +26 -0
- amsdal/py.typed +0 -0
- amsdal/queryset/__init__.py +21 -0
- amsdal/queryset/__init__.pyi +6 -0
- amsdal/schemas/__init__.py +0 -0
- amsdal/schemas/__init__.pyi +0 -0
- amsdal/schemas/core/class_object/model.json +51 -0
- amsdal/schemas/core/class_object/properties/display_name.py +9 -0
- amsdal/schemas/core/class_property/model.json +41 -0
- amsdal/schemas/core/file/hooks/pre_create.py +24 -0
- amsdal/schemas/core/file/hooks/pre_update.py +24 -0
- amsdal/schemas/core/file/model.json +23 -0
- amsdal/schemas/core/file/properties/from_file.py +34 -0
- amsdal/schemas/core/file/properties/mimetype.py +13 -0
- amsdal/schemas/core/file/properties/str.py +6 -0
- amsdal/schemas/core/file/properties/to_file.py +24 -0
- amsdal/schemas/core/file/properties/validate_data.py +31 -0
- amsdal/schemas/core/fixture/model.json +35 -0
- amsdal/schemas/core/option/model.json +19 -0
- amsdal/schemas/core/storage_metadata/model.json +52 -0
- amsdal/schemas/core/validator/model.json +19 -0
- amsdal/schemas/interfaces.py +25 -0
- amsdal/schemas/interfaces.pyi +20 -0
- amsdal/schemas/manager.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/schemas/manager.py +0 -0
- amsdal/schemas/manager.pyi +0 -0
- amsdal/schemas/mixins/__init__.py +0 -0
- amsdal/schemas/mixins/__init__.pyi +0 -0
- amsdal/schemas/mixins/check_dependencies_mixin.py +130 -0
- amsdal/schemas/mixins/check_dependencies_mixin.pyi +45 -0
- amsdal/schemas/mixins/verify_schemas_mixin.py +96 -0
- amsdal/schemas/mixins/verify_schemas_mixin.pyi +33 -0
- amsdal/schemas/repository.py +84 -0
- amsdal/schemas/repository.pyi +22 -0
- amsdal/schemas/types/anything/model.json +7 -0
- amsdal/schemas/types/array/model.json +7 -0
- amsdal/schemas/types/binary/model.json +7 -0
- amsdal/schemas/types/boolean/model.json +17 -0
- amsdal/schemas/types/date/model.json +7 -0
- amsdal/schemas/types/datetime/model.json +7 -0
- amsdal/schemas/types/dictionary/model.json +8 -0
- amsdal/schemas/types/number/model.json +8 -0
- amsdal/schemas/types/object/model.json +53 -0
- amsdal/schemas/types/string/model.json +8 -0
- amsdal/schemas/utils.py +16 -0
- amsdal/schemas/utils.pyi +10 -0
- amsdal/services/__init__.py +11 -0
- amsdal/services/__init__.pyi +4 -0
- amsdal/services/external_connections.py +262 -0
- amsdal/services/external_connections.pyi +190 -0
- amsdal/services/external_model_generator.py +350 -0
- amsdal/services/external_model_generator.pyi +134 -0
- amsdal/services/transaction_execution.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/services/transaction_execution.pyi +93 -0
- amsdal/storages/__init__.py +20 -0
- amsdal/storages/__init__.pyi +8 -0
- amsdal/storages/file_system.py +214 -0
- amsdal/storages/file_system.pyi +36 -0
- amsdal/transactions/__init__.py +13 -0
- amsdal/transactions/__init__.pyi +4 -0
- amsdal/utils/__init__.py +0 -0
- amsdal/utils/__init__.pyi +0 -0
- amsdal/utils/contrib_paths.py +23 -0
- amsdal/utils/contrib_paths.pyi +14 -0
- amsdal/utils/rollback/__init__.py +440 -0
- amsdal/utils/rollback/__init__.pyi +38 -0
- amsdal/utils/tests/__init__.py +0 -0
- amsdal/utils/tests/enums.py +16 -0
- amsdal/utils/tests/factories.py +49 -0
- amsdal/utils/tests/helpers.py +331 -0
- amsdal/utils/tests/migrations.py +157 -0
- amsdal-0.5.34.dist-info/METADATA +375 -0
- amsdal-0.5.34.dist-info/RECORD +276 -0
- amsdal-0.5.34.dist-info/WHEEL +6 -0
- amsdal-0.5.34.dist-info/licenses/LICENSE.txt +107 -0
- amsdal-0.5.34.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
from amsdal_models.migration import migrations
|
|
2
|
+
from amsdal_utils.models.enums import ModuleType
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Migration(migrations.Migration):
|
|
6
|
+
operations: list[migrations.Operation] = [
|
|
7
|
+
migrations.CreateClass(
|
|
8
|
+
module_type=ModuleType.CONTRIB,
|
|
9
|
+
class_name="UpdateValueAction",
|
|
10
|
+
new_schema={
|
|
11
|
+
"title": "UpdateValueAction",
|
|
12
|
+
"type": "FrontendConfigSkipNoneBase",
|
|
13
|
+
"required": ["type", "field_id", "value"],
|
|
14
|
+
"properties": {
|
|
15
|
+
"type": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"options": [{"key": "update_value", "value": "update_value"}],
|
|
18
|
+
"title": "Type",
|
|
19
|
+
"enum": ["update_value"],
|
|
20
|
+
},
|
|
21
|
+
"field_id": {"type": "string", "title": "Field ID"},
|
|
22
|
+
"value": {"type": "anything", "title": "Value"},
|
|
23
|
+
},
|
|
24
|
+
"meta_class": "TypeMeta",
|
|
25
|
+
"custom_code": "from typing import Any\n\nfrom amsdal.contrib.frontend_configs.models.frontend_config_skip_none_base import *\n\n\ndef model_dump(self, **kwargs: Any) -> dict[str, Any]:\n kwargs['exclude_none'] = True\n return super().model_dump(**kwargs)\n\ndef model_dump_json(self, **kwargs: Any) -> str:\n kwargs['exclude_none'] = True\n return super().model_dump_json(**kwargs)",
|
|
26
|
+
"storage_metadata": {"table_name": "UpdateValueAction", "db_fields": {}, "foreign_keys": {}},
|
|
27
|
+
},
|
|
28
|
+
),
|
|
29
|
+
migrations.CreateClass(
|
|
30
|
+
module_type=ModuleType.CONTRIB,
|
|
31
|
+
class_name="InvokeAction",
|
|
32
|
+
new_schema={
|
|
33
|
+
"title": "InvokeAction",
|
|
34
|
+
"type": "FrontendConfigSkipNoneBase",
|
|
35
|
+
"required": ["type", "method", "url"],
|
|
36
|
+
"properties": {
|
|
37
|
+
"type": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"options": [{"key": "invoke", "value": "invoke"}],
|
|
40
|
+
"title": "Type",
|
|
41
|
+
"enum": ["invoke"],
|
|
42
|
+
},
|
|
43
|
+
"method": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"title": "HTTP Method",
|
|
46
|
+
"enum": ["GET", "POST", "PUT", "PATCH", "DELETE"],
|
|
47
|
+
"options": [
|
|
48
|
+
{"key": "GET", "value": "GET"},
|
|
49
|
+
{"key": "POST", "value": "POST"},
|
|
50
|
+
{"key": "PUT", "value": "PUT"},
|
|
51
|
+
{"key": "PATCH", "value": "PATCH"},
|
|
52
|
+
{"key": "DELETE", "value": "DELETE"},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
"url": {"type": "string", "title": "URL"},
|
|
56
|
+
"headers": {"type": "dict", "title": "Headers"},
|
|
57
|
+
"body": {"type": "dict", "title": "Body"},
|
|
58
|
+
"onSuccess": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"items": {"type": "anything"},
|
|
61
|
+
"title": "On Success Actions",
|
|
62
|
+
},
|
|
63
|
+
"onError": {
|
|
64
|
+
"type": "array",
|
|
65
|
+
"items": {"type": "anything"},
|
|
66
|
+
"title": "On Error Actions",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
"meta_class": "TypeMeta",
|
|
70
|
+
"custom_code": "from typing import Any\n\nfrom amsdal.contrib.frontend_configs.models.frontend_config_skip_none_base import *\n\n\ndef model_dump(self, **kwargs: Any) -> dict[str, Any]:\n kwargs['exclude_none'] = True\n return super().model_dump(**kwargs)\n\ndef model_dump_json(self, **kwargs: Any) -> str:\n kwargs['exclude_none'] = True\n return super().model_dump_json(**kwargs)",
|
|
71
|
+
"storage_metadata": {"table_name": "InvokeAction", "db_fields": {}, "foreign_keys": {}},
|
|
72
|
+
},
|
|
73
|
+
),
|
|
74
|
+
migrations.CreateClass(
|
|
75
|
+
module_type=ModuleType.CONTRIB,
|
|
76
|
+
class_name="ChangeContextAction",
|
|
77
|
+
new_schema={
|
|
78
|
+
"title": "ChangeContextAction",
|
|
79
|
+
"type": "FrontendConfigSkipNoneBase",
|
|
80
|
+
"required": ["type", "context"],
|
|
81
|
+
"properties": {
|
|
82
|
+
"type": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"options": [{"key": "change_context", "value": "change_context"}],
|
|
85
|
+
"title": "Type",
|
|
86
|
+
"enum": ["change_context"],
|
|
87
|
+
},
|
|
88
|
+
"context": {"type": "dict", "title": "Context"},
|
|
89
|
+
},
|
|
90
|
+
"meta_class": "TypeMeta",
|
|
91
|
+
"custom_code": "from typing import Any\n\nfrom amsdal.contrib.frontend_configs.models.frontend_config_skip_none_base import *\n\n\ndef model_dump(self, **kwargs: Any) -> dict[str, Any]:\n kwargs['exclude_none'] = True\n return super().model_dump(**kwargs)\n\ndef model_dump_json(self, **kwargs: Any) -> str:\n kwargs['exclude_none'] = True\n return super().model_dump_json(**kwargs)",
|
|
92
|
+
"storage_metadata": {"table_name": "ChangeContextAction", "db_fields": {}, "foreign_keys": {}},
|
|
93
|
+
},
|
|
94
|
+
),
|
|
95
|
+
migrations.CreateClass(
|
|
96
|
+
module_type=ModuleType.CONTRIB,
|
|
97
|
+
class_name="SaveAction",
|
|
98
|
+
new_schema={
|
|
99
|
+
"title": "SaveAction",
|
|
100
|
+
"type": "FrontendConfigSkipNoneBase",
|
|
101
|
+
"required": ["type"],
|
|
102
|
+
"properties": {
|
|
103
|
+
"type": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"options": [{"key": "save", "value": "save"}],
|
|
106
|
+
"title": "Type",
|
|
107
|
+
"enum": ["save"],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
"meta_class": "TypeMeta",
|
|
111
|
+
"custom_code": "from typing import Any\n\nfrom amsdal.contrib.frontend_configs.models.frontend_config_skip_none_base import *\n\n\ndef model_dump(self, **kwargs: Any) -> dict[str, Any]:\n kwargs['exclude_none'] = True\n return super().model_dump(**kwargs)\n\ndef model_dump_json(self, **kwargs: Any) -> str:\n kwargs['exclude_none'] = True\n return super().model_dump_json(**kwargs)",
|
|
112
|
+
"storage_metadata": {"table_name": "SaveAction", "db_fields": {}, "foreign_keys": {}},
|
|
113
|
+
},
|
|
114
|
+
),
|
|
115
|
+
migrations.UpdateClass(
|
|
116
|
+
module_type=ModuleType.CONTRIB,
|
|
117
|
+
class_name="FrontendControlConfig",
|
|
118
|
+
old_schema={
|
|
119
|
+
"title": "FrontendControlConfig",
|
|
120
|
+
"type": "FrontendConfigSkipNoneBase",
|
|
121
|
+
"required": ["type", "name"],
|
|
122
|
+
"properties": {
|
|
123
|
+
"type": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"options": [
|
|
126
|
+
{"key": "Bytes", "value": "Bytes"},
|
|
127
|
+
{"key": "array", "value": "array"},
|
|
128
|
+
{"key": "checkbox", "value": "checkbox"},
|
|
129
|
+
{"key": "date", "value": "date"},
|
|
130
|
+
{"key": "dateTriplet", "value": "dateTriplet"},
|
|
131
|
+
{"key": "datetime", "value": "datetime"},
|
|
132
|
+
{"key": "dict", "value": "dict"},
|
|
133
|
+
{"key": "dropzone", "value": "dropzone"},
|
|
134
|
+
{"key": "email", "value": "email"},
|
|
135
|
+
{"key": "file", "value": "file"},
|
|
136
|
+
{"key": "group", "value": "group"},
|
|
137
|
+
{"key": "group_switch", "value": "group_switch"},
|
|
138
|
+
{"key": "group_toggle", "value": "group_toggle"},
|
|
139
|
+
{"key": "info-group", "value": "info-group"},
|
|
140
|
+
{"key": "infoscreen", "value": "infoscreen"},
|
|
141
|
+
{"key": "multiselect", "value": "multiselect"},
|
|
142
|
+
{"key": "number", "value": "number"},
|
|
143
|
+
{"key": "number-operations", "value": "number-operations"},
|
|
144
|
+
{"key": "number-slider", "value": "number-slider"},
|
|
145
|
+
{"key": "number_equals", "value": "number_equals"},
|
|
146
|
+
{"key": "number_initial", "value": "number_initial"},
|
|
147
|
+
{"key": "number_minus", "value": "number_minus"},
|
|
148
|
+
{"key": "number_plus", "value": "number_plus"},
|
|
149
|
+
{"key": "object", "value": "object"},
|
|
150
|
+
{"key": "object_group", "value": "object_group"},
|
|
151
|
+
{"key": "object_latest", "value": "object_latest"},
|
|
152
|
+
{"key": "password", "value": "password"},
|
|
153
|
+
{"key": "phone", "value": "phone"},
|
|
154
|
+
{"key": "radio", "value": "radio"},
|
|
155
|
+
{"key": "select", "value": "select"},
|
|
156
|
+
{"key": "text", "value": "text"},
|
|
157
|
+
{"key": "textarea", "value": "textarea"},
|
|
158
|
+
{"key": "time", "value": "time"},
|
|
159
|
+
{"key": "toggle", "value": "toggle"},
|
|
160
|
+
{"key": "sections", "value": "sections"},
|
|
161
|
+
{"key": "section", "value": "section"},
|
|
162
|
+
],
|
|
163
|
+
"title": "Type",
|
|
164
|
+
"enum": [
|
|
165
|
+
"Bytes",
|
|
166
|
+
"array",
|
|
167
|
+
"checkbox",
|
|
168
|
+
"date",
|
|
169
|
+
"dateTriplet",
|
|
170
|
+
"datetime",
|
|
171
|
+
"dict",
|
|
172
|
+
"dropzone",
|
|
173
|
+
"email",
|
|
174
|
+
"file",
|
|
175
|
+
"group",
|
|
176
|
+
"group_switch",
|
|
177
|
+
"group_toggle",
|
|
178
|
+
"info-group",
|
|
179
|
+
"infoscreen",
|
|
180
|
+
"multiselect",
|
|
181
|
+
"number",
|
|
182
|
+
"number-operations",
|
|
183
|
+
"number-slider",
|
|
184
|
+
"number_equals",
|
|
185
|
+
"number_initial",
|
|
186
|
+
"number_minus",
|
|
187
|
+
"number_plus",
|
|
188
|
+
"object",
|
|
189
|
+
"object_group",
|
|
190
|
+
"object_latest",
|
|
191
|
+
"password",
|
|
192
|
+
"phone",
|
|
193
|
+
"radio",
|
|
194
|
+
"select",
|
|
195
|
+
"text",
|
|
196
|
+
"textarea",
|
|
197
|
+
"time",
|
|
198
|
+
"toggle",
|
|
199
|
+
"sections",
|
|
200
|
+
"section",
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
"name": {"type": "string", "title": "Name"},
|
|
204
|
+
"actions": {
|
|
205
|
+
"type": "array",
|
|
206
|
+
"items": {"type": "FrontendConfigControlAction", "title": "FrontendConfigControlAction"},
|
|
207
|
+
"title": "Actions",
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
"meta_class": "TypeMeta",
|
|
211
|
+
"storage_metadata": {"table_name": "FrontendControlConfig", "db_fields": {}, "foreign_keys": {}},
|
|
212
|
+
},
|
|
213
|
+
new_schema={
|
|
214
|
+
"title": "FrontendControlConfig",
|
|
215
|
+
"type": "FrontendConfigSkipNoneBase",
|
|
216
|
+
"required": ["type", "name"],
|
|
217
|
+
"properties": {
|
|
218
|
+
"type": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"options": [
|
|
221
|
+
{"key": "Bytes", "value": "Bytes"},
|
|
222
|
+
{"key": "array", "value": "array"},
|
|
223
|
+
{"key": "button", "value": "button"},
|
|
224
|
+
{"key": "chat", "value": "chat"},
|
|
225
|
+
{"key": "checkbox", "value": "checkbox"},
|
|
226
|
+
{"key": "date", "value": "date"},
|
|
227
|
+
{"key": "dateTriplet", "value": "dateTriplet"},
|
|
228
|
+
{"key": "datetime", "value": "datetime"},
|
|
229
|
+
{"key": "dict", "value": "dict"},
|
|
230
|
+
{"key": "dropzone", "value": "dropzone"},
|
|
231
|
+
{"key": "email", "value": "email"},
|
|
232
|
+
{"key": "file", "value": "file"},
|
|
233
|
+
{"key": "group", "value": "group"},
|
|
234
|
+
{"key": "group_switch", "value": "group_switch"},
|
|
235
|
+
{"key": "group_toggle", "value": "group_toggle"},
|
|
236
|
+
{"key": "info-group", "value": "info-group"},
|
|
237
|
+
{"key": "infoscreen", "value": "infoscreen"},
|
|
238
|
+
{"key": "multiselect", "value": "multiselect"},
|
|
239
|
+
{"key": "number", "value": "number"},
|
|
240
|
+
{"key": "number-operations", "value": "number-operations"},
|
|
241
|
+
{"key": "number-slider", "value": "number-slider"},
|
|
242
|
+
{"key": "number_equals", "value": "number_equals"},
|
|
243
|
+
{"key": "number_initial", "value": "number_initial"},
|
|
244
|
+
{"key": "number_minus", "value": "number_minus"},
|
|
245
|
+
{"key": "number_plus", "value": "number_plus"},
|
|
246
|
+
{"key": "object", "value": "object"},
|
|
247
|
+
{"key": "object_group", "value": "object_group"},
|
|
248
|
+
{"key": "object_latest", "value": "object_latest"},
|
|
249
|
+
{"key": "password", "value": "password"},
|
|
250
|
+
{"key": "phone", "value": "phone"},
|
|
251
|
+
{"key": "radio", "value": "radio"},
|
|
252
|
+
{"key": "select", "value": "select"},
|
|
253
|
+
{"key": "text", "value": "text"},
|
|
254
|
+
{"key": "textarea", "value": "textarea"},
|
|
255
|
+
{"key": "time", "value": "time"},
|
|
256
|
+
{"key": "toggle", "value": "toggle"},
|
|
257
|
+
{"key": "sections", "value": "sections"},
|
|
258
|
+
{"key": "section", "value": "section"},
|
|
259
|
+
],
|
|
260
|
+
"title": "Type",
|
|
261
|
+
"enum": [
|
|
262
|
+
"Bytes",
|
|
263
|
+
"array",
|
|
264
|
+
"button",
|
|
265
|
+
"chat",
|
|
266
|
+
"checkbox",
|
|
267
|
+
"date",
|
|
268
|
+
"dateTriplet",
|
|
269
|
+
"datetime",
|
|
270
|
+
"dict",
|
|
271
|
+
"dropzone",
|
|
272
|
+
"email",
|
|
273
|
+
"file",
|
|
274
|
+
"group",
|
|
275
|
+
"group_switch",
|
|
276
|
+
"group_toggle",
|
|
277
|
+
"info-group",
|
|
278
|
+
"infoscreen",
|
|
279
|
+
"multiselect",
|
|
280
|
+
"number",
|
|
281
|
+
"number-operations",
|
|
282
|
+
"number-slider",
|
|
283
|
+
"number_equals",
|
|
284
|
+
"number_initial",
|
|
285
|
+
"number_minus",
|
|
286
|
+
"number_plus",
|
|
287
|
+
"object",
|
|
288
|
+
"object_group",
|
|
289
|
+
"object_latest",
|
|
290
|
+
"password",
|
|
291
|
+
"phone",
|
|
292
|
+
"radio",
|
|
293
|
+
"select",
|
|
294
|
+
"text",
|
|
295
|
+
"textarea",
|
|
296
|
+
"time",
|
|
297
|
+
"toggle",
|
|
298
|
+
"sections",
|
|
299
|
+
"section",
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
"id": {"type": "string", "title": "ID"},
|
|
303
|
+
"name": {"type": "string", "title": "Name"},
|
|
304
|
+
"label": {"type": "string", "title": "Label"},
|
|
305
|
+
"required": {"type": "boolean", "title": "Required"},
|
|
306
|
+
"hideLabel": {"type": "boolean", "title": "Hide Label"},
|
|
307
|
+
"actions": {
|
|
308
|
+
"type": "array",
|
|
309
|
+
"items": {"type": "anything"},
|
|
310
|
+
"title": "Actions",
|
|
311
|
+
},
|
|
312
|
+
"validators": {
|
|
313
|
+
"type": "array",
|
|
314
|
+
"items": {"type": "FrontendConfigValidator", "title": "FrontendConfigValidator"},
|
|
315
|
+
"title": "Validators",
|
|
316
|
+
},
|
|
317
|
+
"asyncValidators": {
|
|
318
|
+
"type": "array",
|
|
319
|
+
"items": {"type": "FrontendConfigAsyncValidator", "title": "FrontendConfigAsyncValidator"},
|
|
320
|
+
"title": "Async Validators",
|
|
321
|
+
},
|
|
322
|
+
"activators": {
|
|
323
|
+
"type": "array",
|
|
324
|
+
"items": {"type": "FrontendActivatorConfig", "title": "FrontendActivatorConfig"},
|
|
325
|
+
"title": "Activators",
|
|
326
|
+
},
|
|
327
|
+
"additionalText": {"type": "string", "title": "Additional Text"},
|
|
328
|
+
"value": {"type": "anything", "title": "Value"},
|
|
329
|
+
"placeholder": {"type": "string", "title": "Placeholder"},
|
|
330
|
+
"options": {
|
|
331
|
+
"type": "array",
|
|
332
|
+
"items": {"type": "FrontendConfigOption", "title": "FrontendConfigOption"},
|
|
333
|
+
"title": "Options",
|
|
334
|
+
},
|
|
335
|
+
"mask": {"type": "FrontendConfigTextMask", "title": "Mask"},
|
|
336
|
+
"controls": {
|
|
337
|
+
"type": "array",
|
|
338
|
+
"items": {"type": "FrontendControlConfig", "title": "FrontendControlConfig"},
|
|
339
|
+
"title": "Controls",
|
|
340
|
+
},
|
|
341
|
+
"showSearch": {"type": "boolean", "title": "Show Search"},
|
|
342
|
+
"sliderOptions": {"type": "FrontendConfigSliderOption", "title": "Slider Option"},
|
|
343
|
+
"customLabel": {"type": "array", "items": {"type": "string"}, "title": "Custom Label"},
|
|
344
|
+
"control": {"type": "FrontendControlConfig", "title": "Control"},
|
|
345
|
+
"entityType": {"type": "string", "title": "Entity Type"},
|
|
346
|
+
"condition": {"type": "Condition", "title": "Condition"},
|
|
347
|
+
},
|
|
348
|
+
"meta_class": "TypeMeta",
|
|
349
|
+
"storage_metadata": {"table_name": "FrontendControlConfig", "db_fields": {}, "foreign_keys": {}},
|
|
350
|
+
},
|
|
351
|
+
),
|
|
352
|
+
]
|
amsdal/contrib/frontend_configs/migrations/0003_create_class_frontendconfigdashboardelement.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
from amsdal_models.migration import migrations
|
|
2
|
+
from amsdal_utils.models.enums import ModuleType
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Migration(migrations.Migration):
|
|
6
|
+
operations: list[migrations.Operation] = [
|
|
7
|
+
migrations.CreateClass(
|
|
8
|
+
module_type=ModuleType.CONTRIB,
|
|
9
|
+
class_name="FrontendConfigDashboard",
|
|
10
|
+
new_schema={
|
|
11
|
+
"title": "FrontendConfigDashboard",
|
|
12
|
+
"required": ["title", "elements"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"title": {"type": "string", "title": "Title", "description": "Title of the dashboard"},
|
|
15
|
+
"elements": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": {"type": "FrontendConfigDashboardElement", "title": "FrontendConfigDashboardElement"},
|
|
18
|
+
"title": "Elements",
|
|
19
|
+
"description": "List of dashboard elements",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
"storage_metadata": {
|
|
23
|
+
"table_name": "FrontendConfigDashboard",
|
|
24
|
+
"db_fields": {},
|
|
25
|
+
"primary_key": ["partition_key"],
|
|
26
|
+
"foreign_keys": {},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
),
|
|
30
|
+
migrations.CreateClass(
|
|
31
|
+
module_type=ModuleType.CONTRIB,
|
|
32
|
+
class_name="FrontendConfigDashboardElement",
|
|
33
|
+
new_schema={
|
|
34
|
+
"title": "FrontendConfigDashboardElement",
|
|
35
|
+
"required": ["type"],
|
|
36
|
+
"properties": {
|
|
37
|
+
"type": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"options": [
|
|
40
|
+
{"key": "section", "value": "section"},
|
|
41
|
+
{"key": "grid", "value": "grid"},
|
|
42
|
+
{"key": "grid_col", "value": "grid_col"},
|
|
43
|
+
{"key": "chart", "value": "chart"},
|
|
44
|
+
{"key": "table", "value": "table"},
|
|
45
|
+
],
|
|
46
|
+
"title": "Type",
|
|
47
|
+
"enum": ["section", "grid", "grid_col", "chart", "table"],
|
|
48
|
+
},
|
|
49
|
+
"chart_type": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"title": "Chart Type",
|
|
52
|
+
"description": "Type of chart (for chart elements)",
|
|
53
|
+
},
|
|
54
|
+
"columns": {
|
|
55
|
+
"type": "integer",
|
|
56
|
+
"title": "Columns",
|
|
57
|
+
"description": "Number of columns for grid layout",
|
|
58
|
+
},
|
|
59
|
+
"rows": {"type": "integer", "title": "Rows", "description": "Number of rows for grid layout"},
|
|
60
|
+
"title": {"type": "string", "title": "Title", "description": "Title of the dashboard element"},
|
|
61
|
+
"elements": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"items": {"type": "FrontendConfigDashboardElement", "title": "FrontendConfigDashboardElement"},
|
|
64
|
+
"title": "Elements",
|
|
65
|
+
"description": "Nested dashboard elements for section or grid types",
|
|
66
|
+
},
|
|
67
|
+
"data_source": {
|
|
68
|
+
"type": "FrontendConfigDashboardDataSource",
|
|
69
|
+
"title": "FrontendConfigDashboardDataSource",
|
|
70
|
+
"description": "Data source configuration for chart or table elements",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
"meta_class": "TypeMeta",
|
|
74
|
+
"storage_metadata": {
|
|
75
|
+
"table_name": "FrontendConfigDashboardElement",
|
|
76
|
+
"db_fields": {},
|
|
77
|
+
"foreign_keys": {},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
),
|
|
81
|
+
migrations.CreateClass(
|
|
82
|
+
module_type=ModuleType.CONTRIB,
|
|
83
|
+
class_name="FrontendConfigDashboardQueryParams",
|
|
84
|
+
new_schema={
|
|
85
|
+
"title": "FrontendConfigDashboardQueryParams",
|
|
86
|
+
"required": ["field", "operator"],
|
|
87
|
+
"properties": {
|
|
88
|
+
"field": {"type": "string", "title": "Field", "description": "Field name for the query parameter"},
|
|
89
|
+
"operator": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"title": "Operator",
|
|
92
|
+
"description": "Operator for the query parameter",
|
|
93
|
+
},
|
|
94
|
+
"value": {"type": "anything", "title": "Value", "description": "Value for the query parameter"},
|
|
95
|
+
},
|
|
96
|
+
"meta_class": "TypeMeta",
|
|
97
|
+
"storage_metadata": {
|
|
98
|
+
"table_name": "FrontendConfigDashboardQueryParams",
|
|
99
|
+
"db_fields": {},
|
|
100
|
+
"foreign_keys": {},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
),
|
|
104
|
+
migrations.CreateClass(
|
|
105
|
+
module_type=ModuleType.CONTRIB,
|
|
106
|
+
class_name="FrontendConfigDashboardDataSource",
|
|
107
|
+
new_schema={
|
|
108
|
+
"title": "FrontendConfigDashboardDataSource",
|
|
109
|
+
"required": ["type", "entity_name"],
|
|
110
|
+
"properties": {
|
|
111
|
+
"type": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"options": [{"key": "class", "value": "class"}, {"key": "transaction", "value": "transaction"}],
|
|
114
|
+
"title": "Type",
|
|
115
|
+
"enum": ["class", "transaction"],
|
|
116
|
+
},
|
|
117
|
+
"entity_name": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"title": "Entity Name",
|
|
120
|
+
"description": "Name of the entity or transaction",
|
|
121
|
+
},
|
|
122
|
+
"query_params": {
|
|
123
|
+
"type": "array",
|
|
124
|
+
"items": {
|
|
125
|
+
"type": "FrontendConfigDashboardQueryParams",
|
|
126
|
+
"title": "FrontendConfigDashboardQueryParams",
|
|
127
|
+
},
|
|
128
|
+
"title": "Query Params",
|
|
129
|
+
"description": "List of query parameters for filtering data (for class type)",
|
|
130
|
+
},
|
|
131
|
+
"body": {
|
|
132
|
+
"type": "anything",
|
|
133
|
+
"title": "Body",
|
|
134
|
+
"description": "Request body for transaction data source (for transaction type)",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
"meta_class": "TypeMeta",
|
|
138
|
+
"storage_metadata": {
|
|
139
|
+
"table_name": "FrontendConfigDashboardDataSource",
|
|
140
|
+
"db_fields": {},
|
|
141
|
+
"foreign_keys": {},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
),
|
|
145
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from typing import ClassVar
|
|
3
|
+
|
|
4
|
+
from amsdal_models.builder.validators.options_validators import validate_options
|
|
5
|
+
from amsdal_utils.models.enums import ModuleType
|
|
6
|
+
from pydantic.fields import Field
|
|
7
|
+
from pydantic.functional_validators import field_validator
|
|
8
|
+
|
|
9
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_group_validator import * # noqa: F403
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class FrontendActivatorConfig(FrontendConfigGroupValidator): # noqa: F405
|
|
13
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
14
|
+
mainControl: str | None = Field(None, title='Main Control') # noqa: N815
|
|
15
|
+
dependentControls: list[str] | None = Field(None, title='Dependent Controls') # noqa: N815
|
|
16
|
+
condition: str | None = Field(None, title='Condition')
|
|
17
|
+
value: Any | None = Field(None, title='Value')
|
|
18
|
+
|
|
19
|
+
@field_validator('condition')
|
|
20
|
+
@classmethod
|
|
21
|
+
def validate_value_in_options_condition(cls: type, value: Any) -> Any:
|
|
22
|
+
return validate_options(value, options=['eq', 'exist', 'gt', 'gte', 'lt', 'lte', 'neq'])
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
3
|
+
from amsdal_utils.models.enums import ModuleType
|
|
4
|
+
from pydantic.fields import Field
|
|
5
|
+
|
|
6
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_skip_none_base import * # noqa: F403
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class FrontendConfigAsyncValidator(FrontendConfigSkipNoneBase): # noqa: F405
|
|
10
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
11
|
+
endpoint: str | None = Field(None, title='Endpoint')
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from typing import ClassVar
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from amsdal_models.builder.validators.options_validators import validate_options
|
|
6
|
+
from amsdal_utils.models.enums import ModuleType
|
|
7
|
+
from pydantic import Field
|
|
8
|
+
from pydantic import field_validator
|
|
9
|
+
|
|
10
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_skip_none_base import * # noqa: F403
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
'ActionType',
|
|
14
|
+
'ChangeContextAction',
|
|
15
|
+
'FrontendConfigControlAction',
|
|
16
|
+
'InvokeAction',
|
|
17
|
+
'SaveAction',
|
|
18
|
+
'UpdateValueAction',
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class FrontendConfigControlAction(FrontendConfigSkipNoneBase): # noqa: F405
|
|
23
|
+
"""Navigation action for form controls (backward compatible)."""
|
|
24
|
+
|
|
25
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
26
|
+
action: str = Field(title='Action')
|
|
27
|
+
text: str = Field(title='Text')
|
|
28
|
+
type: str = Field(title='Type')
|
|
29
|
+
dataLayerEvent: str | None = Field(None, title='Data Layer Event') # noqa: N815
|
|
30
|
+
activator: str | None = Field(None, title='Activator')
|
|
31
|
+
icon: str | None = Field(None, title='Icon')
|
|
32
|
+
|
|
33
|
+
@field_validator('type')
|
|
34
|
+
@classmethod
|
|
35
|
+
def validate_value_in_options_type(cls: type, value: Any) -> Any: # type: ignore # noqa: A003
|
|
36
|
+
return validate_options(value, options=['action-button', 'arrow-next', 'arrow-prev', 'text-next', 'text-prev'])
|
|
37
|
+
|
|
38
|
+
@field_validator('action', mode='after')
|
|
39
|
+
@classmethod
|
|
40
|
+
def validate_action(cls, v: str) -> str:
|
|
41
|
+
"""
|
|
42
|
+
Validates the action string to ensure it is one of the allowed values.
|
|
43
|
+
|
|
44
|
+
This method checks if the action string starts with 'navigate::' or is one of the predefined
|
|
45
|
+
actions. If the action string is invalid, it raises a ValueError.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
cls: The class this method is attached to.
|
|
49
|
+
v (str): The action string to validate.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
str: The validated action string.
|
|
53
|
+
|
|
54
|
+
Raises:
|
|
55
|
+
ValueError: If the action string is not valid.
|
|
56
|
+
"""
|
|
57
|
+
if not v.startswith('navigate::') and v not in [
|
|
58
|
+
'goPrev',
|
|
59
|
+
'goNext',
|
|
60
|
+
'goNextWithSubmit',
|
|
61
|
+
'submit',
|
|
62
|
+
'submitWithDataLayer',
|
|
63
|
+
]:
|
|
64
|
+
msg = 'Action must be one of: goPrev, goNext, goNextWithSubmit, submit, submitWithDataLayer, navigate::{string}' # noqa: E501
|
|
65
|
+
raise ValueError(msg)
|
|
66
|
+
return v
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class UpdateValueAction(FrontendConfigSkipNoneBase): # noqa: F405
|
|
70
|
+
"""Action to update a field value (used in onSuccess callbacks)."""
|
|
71
|
+
|
|
72
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
73
|
+
type: Literal['update_value'] = Field(title='Type')
|
|
74
|
+
field_id: str = Field(title='Field ID')
|
|
75
|
+
value: Any = Field(title='Value')
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class InvokeAction(FrontendConfigSkipNoneBase): # noqa: F405
|
|
79
|
+
"""Action to invoke an API endpoint."""
|
|
80
|
+
|
|
81
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
82
|
+
type: Literal['invoke'] = Field(title='Type')
|
|
83
|
+
method: Literal['GET', 'POST', 'PUT', 'PATCH', 'DELETE'] = Field(title='HTTP Method')
|
|
84
|
+
url: str = Field(title='URL')
|
|
85
|
+
headers: dict[str, str] | None = Field(None, title='Headers')
|
|
86
|
+
body: dict[str, Any] | None = Field(None, title='Body')
|
|
87
|
+
onSuccess: list['ActionType'] | None = Field(None, title='On Success Actions') # noqa: N815
|
|
88
|
+
onError: list['ActionType'] | None = Field(None, title='On Error Actions') # noqa: N815
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class ChangeContextAction(FrontendConfigSkipNoneBase): # noqa: F405
|
|
92
|
+
"""Action to change the context."""
|
|
93
|
+
|
|
94
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
95
|
+
type: Literal['change_context'] = Field(title='Type')
|
|
96
|
+
context: dict[str, Any] = Field(title='Context')
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class SaveAction(FrontendConfigSkipNoneBase): # noqa: F405
|
|
100
|
+
"""Action to save data."""
|
|
101
|
+
|
|
102
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
103
|
+
type: Literal['save'] = Field(title='Type')
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# Union type for all action types - discriminated by 'type' field
|
|
107
|
+
ActionType = FrontendConfigControlAction | InvokeAction | UpdateValueAction | ChangeContextAction | SaveAction
|
|
108
|
+
|
|
109
|
+
# Rebuild model to handle forward references
|
|
110
|
+
InvokeAction.model_rebuild()
|