amsdal 0.4.10__cp312-cp312-macosx_10_13_universal2.whl → 0.5.33__cp312-cp312-macosx_10_13_universal2.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 +28 -0
- amsdal/__about__.py +1 -1
- amsdal/__migrations__/0000_initial.py +22 -203
- 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-312-darwin.so +0 -0
- amsdal/cloud/client.cpython-312-darwin.so +0 -0
- amsdal/cloud/constants.cpython-312-darwin.so +0 -0
- amsdal/cloud/enums.cpython-312-darwin.so +0 -0
- amsdal/cloud/models/__init__.cpython-312-darwin.so +0 -0
- amsdal/cloud/models/base.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/__init__.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/__init__.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/add_basic_auth.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/add_dependency.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/add_secret.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/base.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/create_deploy.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/create_env.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/create_session.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_basic_auth.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_dependency.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_env.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_secret.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/destroy_deploy.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/expose_db.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/get_monitoring_info.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/list_dependencies.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/list_deploys.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/list_envs.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/list_secrets.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/manager.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/signup_action.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/actions/update_deploy.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/__init__.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/base.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/credentials.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/manager.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/signup_service.cpython-312-darwin.so +0 -0
- amsdal/cloud/services/auth/token.cpython-312-darwin.so +0 -0
- amsdal/configs/main.py +17 -1
- amsdal/configs/main.pyi +7 -3
- amsdal/contrib/__init__.cpython-312-darwin.so +0 -0
- amsdal/contrib/auth/errors.py +36 -0
- amsdal/contrib/auth/errors.pyi +12 -0
- amsdal/contrib/auth/lifecycle/consumer.py +3 -3
- amsdal/contrib/auth/lifecycle/consumer.pyi +3 -0
- amsdal/contrib/auth/migrations/0000_initial.py +55 -52
- 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 +117 -0
- amsdal/contrib/auth/models/mfa_device.py +86 -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 +50 -0
- amsdal/contrib/auth/services/__init__.py +1 -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 +8 -0
- amsdal/contrib/auth/settings.pyi +8 -0
- amsdal/contrib/auth/transactions/__init__.py +1 -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/mfa.py +257 -0
- amsdal/contrib/auth/utils/mfa.pyi +119 -0
- amsdal/contrib/frontend_configs/conversion/convert.py +32 -5
- amsdal/contrib/frontend_configs/migrations/0000_initial.py +154 -183
- 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/frontend_config_control_action.py +57 -1
- amsdal/contrib/frontend_configs/models/frontend_config_dashboard.py +51 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.py +69 -46
- amsdal/fixtures/__init__.cpython-312-darwin.so +0 -0
- amsdal/fixtures/manager.cpython-312-darwin.so +0 -0
- amsdal/fixtures/utils.cpython-312-darwin.so +0 -0
- amsdal/manager.cpython-312-darwin.so +0 -0
- amsdal/manager.pyi +5 -0
- amsdal/mixins/__init__.cpython-312-darwin.so +0 -0
- amsdal/mixins/class_versions_mixin.cpython-312-darwin.so +0 -0
- amsdal/models/core/class_object.py +7 -6
- amsdal/models/core/class_property.py +7 -1
- amsdal/models/core/file.py +168 -81
- amsdal/models/core/storage_metadata.py +15 -0
- amsdal/models/mixins.py +31 -0
- amsdal/models/types/object.py +3 -3
- amsdal/schemas/core/class_object/model.json +20 -0
- amsdal/schemas/core/class_property/model.json +19 -0
- amsdal/schemas/core/file/properties/validate_data.py +2 -3
- amsdal/schemas/core/storage_metadata/model.json +52 -0
- amsdal/schemas/interfaces.pyi +1 -1
- amsdal/schemas/manager.cpython-312-darwin.so +0 -0
- amsdal/schemas/mixins/check_dependencies_mixin.py +23 -8
- amsdal/schemas/mixins/check_dependencies_mixin.pyi +5 -2
- amsdal/schemas/utils.pyi +2 -2
- 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-312-darwin.so +0 -0
- amsdal/services/transaction_execution.pyi +1 -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/utils/rollback/__init__.pyi +6 -0
- amsdal/utils/tests/enums.py +0 -2
- amsdal/utils/tests/helpers.py +213 -381
- amsdal/utils/tests/migrations.py +157 -0
- {amsdal-0.4.10.dist-info → amsdal-0.5.33.dist-info}/METADATA +17 -11
- {amsdal-0.4.10.dist-info → amsdal-0.5.33.dist-info}/RECORD +131 -124
- {amsdal-0.4.10.dist-info → amsdal-0.5.33.dist-info}/WHEEL +1 -1
- amsdal/__migrations__/0001_datetime_type.py +0 -18
- amsdal/__migrations__/0002_fixture_order.py +0 -44
- amsdal/__migrations__/0003_schema_type_in_class_meta.py +0 -44
- amsdal/contrib/auth/models/login_session.pyi +0 -37
- amsdal/contrib/auth/models/permission.pyi +0 -18
- amsdal/contrib/auth/models/user.pyi +0 -46
- amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +0 -12
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +0 -7
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +0 -32
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +0 -11
- amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +0 -8
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +0 -8
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +0 -9
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +0 -10
- amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +0 -15
- amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +0 -35
- amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +0 -9
- amsdal/models/__init__.pyi +0 -9
- amsdal/models/core/class_object.pyi +0 -24
- amsdal/models/core/class_object_meta.py +0 -26
- amsdal/models/core/class_object_meta.pyi +0 -15
- amsdal/models/core/class_property.pyi +0 -11
- amsdal/models/core/class_property_meta.py +0 -15
- amsdal/models/core/class_property_meta.pyi +0 -10
- amsdal/models/core/file.pyi +0 -104
- amsdal/models/core/fixture.pyi +0 -14
- amsdal/models/core/option.pyi +0 -8
- amsdal/models/core/validator.pyi +0 -8
- amsdal/models/types/object.pyi +0 -16
- amsdal/schemas/core/class_object_meta/model.json +0 -59
- amsdal/schemas/core/class_property_meta/model.json +0 -23
- amsdal/services/__init__.cpython-312-darwin.so +0 -0
- /amsdal/contrib/auth/{models → services}/__init__.pyi +0 -0
- /amsdal/contrib/{frontend_configs/models → auth/transactions}/__init__.pyi +0 -0
- /amsdal/{models/core/__init__.pyi → contrib/auth/utils/__init__.py} +0 -0
- /amsdal/{models/types → contrib/auth/utils}/__init__.pyi +0 -0
- {amsdal-0.4.10.dist-info → amsdal-0.5.33.dist-info}/licenses/LICENSE.txt +0 -0
- {amsdal-0.4.10.dist-info → amsdal-0.5.33.dist-info}/top_level.txt +0 -0
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
|
+
]
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
from typing import ClassVar
|
|
3
|
+
from typing import Literal
|
|
3
4
|
|
|
4
5
|
from amsdal_models.builder.validators.options_validators import validate_options
|
|
5
6
|
from amsdal_utils.models.enums import ModuleType
|
|
7
|
+
from pydantic import Field
|
|
6
8
|
from pydantic import field_validator
|
|
7
|
-
from pydantic.fields import Field
|
|
8
9
|
|
|
9
10
|
from amsdal.contrib.frontend_configs.models.frontend_config_skip_none_base import * # noqa: F403
|
|
10
11
|
|
|
12
|
+
__all__ = [
|
|
13
|
+
'ActionType',
|
|
14
|
+
'ChangeContextAction',
|
|
15
|
+
'FrontendConfigControlAction',
|
|
16
|
+
'InvokeAction',
|
|
17
|
+
'SaveAction',
|
|
18
|
+
'UpdateValueAction',
|
|
19
|
+
]
|
|
20
|
+
|
|
11
21
|
|
|
12
22
|
class FrontendConfigControlAction(FrontendConfigSkipNoneBase): # noqa: F405
|
|
23
|
+
"""Navigation action for form controls (backward compatible)."""
|
|
24
|
+
|
|
13
25
|
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
14
26
|
action: str = Field(title='Action')
|
|
15
27
|
text: str = Field(title='Text')
|
|
@@ -52,3 +64,47 @@ class FrontendConfigControlAction(FrontendConfigSkipNoneBase): # noqa: F405
|
|
|
52
64
|
msg = 'Action must be one of: goPrev, goNext, goNextWithSubmit, submit, submitWithDataLayer, navigate::{string}' # noqa: E501
|
|
53
65
|
raise ValueError(msg)
|
|
54
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()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from typing import ClassVar
|
|
3
|
+
from typing import Literal
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
from amsdal_models.classes.model import Model
|
|
7
|
+
from amsdal_models.classes.model import TypeModel
|
|
8
|
+
from amsdal_utils.models.enums import ModuleType
|
|
9
|
+
from pydantic.fields import Field
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class FrontendConfigDashboardQueryParams(TypeModel):
|
|
13
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
14
|
+
|
|
15
|
+
field: str = Field(..., description='Field name for the query parameter')
|
|
16
|
+
operator: str = Field(..., description='Operator for the query parameter')
|
|
17
|
+
value: Optional[Any] = Field(None, description='Value for the query parameter')
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class FrontendConfigDashboardDataSource(TypeModel):
|
|
21
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
22
|
+
|
|
23
|
+
type: Literal['class', 'transaction']
|
|
24
|
+
entity_name: str = Field(..., description='Name of the entity or transaction')
|
|
25
|
+
query_params: list[FrontendConfigDashboardQueryParams] | None = Field(
|
|
26
|
+
None, description='List of query parameters for filtering data (for class type)'
|
|
27
|
+
)
|
|
28
|
+
body: Any = Field(None, description='Request body for transaction data source (for transaction type)')
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class FrontendConfigDashboardElement(TypeModel):
|
|
32
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
33
|
+
|
|
34
|
+
type: Literal['section', 'grid', 'grid_col', 'chart', 'table']
|
|
35
|
+
chart_type: str | None = Field(None, description='Type of chart (for chart elements)')
|
|
36
|
+
columns: int | None = Field(None, description='Number of columns for grid layout')
|
|
37
|
+
rows: int | None = Field(None, description='Number of rows for grid layout')
|
|
38
|
+
title: str | None = Field(None, description='Title of the dashboard element')
|
|
39
|
+
elements: list['FrontendConfigDashboardElement'] | None = Field(
|
|
40
|
+
None, description='Nested dashboard elements for section or grid types'
|
|
41
|
+
)
|
|
42
|
+
data_source: FrontendConfigDashboardDataSource | None = Field(
|
|
43
|
+
None, description='Data source configuration for chart or table elements'
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class FrontendConfigDashboard(Model):
|
|
48
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
49
|
+
|
|
50
|
+
title: str = Field(..., description='Title of the dashboard')
|
|
51
|
+
elements: list[FrontendConfigDashboardElement] = Field(..., description='List of dashboard elements')
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
1
2
|
from typing import Any
|
|
2
3
|
from typing import ClassVar
|
|
4
|
+
from typing import Literal
|
|
3
5
|
from typing import Optional
|
|
4
6
|
|
|
5
|
-
from amsdal_models.builder.validators.options_validators import validate_options
|
|
6
7
|
from amsdal_utils.models.enums import ModuleType
|
|
7
8
|
from pydantic.fields import Field
|
|
8
|
-
from pydantic.functional_validators import field_validator
|
|
9
9
|
|
|
10
10
|
from amsdal.contrib.frontend_configs.models.frontend_activator_config import * # noqa: F403
|
|
11
11
|
from amsdal.contrib.frontend_configs.models.frontend_config_async_validator import * # noqa: F403
|
|
@@ -16,15 +16,77 @@ from amsdal.contrib.frontend_configs.models.frontend_config_slider_option import
|
|
|
16
16
|
from amsdal.contrib.frontend_configs.models.frontend_config_text_mask import * # noqa: F403
|
|
17
17
|
from amsdal.contrib.frontend_configs.models.frontend_config_validator import * # noqa: F403
|
|
18
18
|
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_control_action import ActionType
|
|
21
|
+
|
|
22
|
+
ConfigType = Literal[
|
|
23
|
+
'Bytes',
|
|
24
|
+
'array',
|
|
25
|
+
'attachment',
|
|
26
|
+
'wizard',
|
|
27
|
+
'button',
|
|
28
|
+
'chat',
|
|
29
|
+
'checkbox',
|
|
30
|
+
'date',
|
|
31
|
+
'dateTriplet',
|
|
32
|
+
'datetime',
|
|
33
|
+
'dict',
|
|
34
|
+
'dropzone',
|
|
35
|
+
'email',
|
|
36
|
+
'file',
|
|
37
|
+
'group',
|
|
38
|
+
'group_switch',
|
|
39
|
+
'group_toggle',
|
|
40
|
+
'info-group',
|
|
41
|
+
'infoscreen',
|
|
42
|
+
'multiselect',
|
|
43
|
+
'number',
|
|
44
|
+
'number-operations',
|
|
45
|
+
'number-slider',
|
|
46
|
+
'number_equals',
|
|
47
|
+
'number_initial',
|
|
48
|
+
'number_minus',
|
|
49
|
+
'number_plus',
|
|
50
|
+
'object',
|
|
51
|
+
'object_group',
|
|
52
|
+
'object_latest',
|
|
53
|
+
'password',
|
|
54
|
+
'phone',
|
|
55
|
+
'radio',
|
|
56
|
+
'select',
|
|
57
|
+
'text',
|
|
58
|
+
'textarea',
|
|
59
|
+
'time',
|
|
60
|
+
'toggle',
|
|
61
|
+
'sections',
|
|
62
|
+
'section',
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class ConditionItem(FrontendConfigSkipNoneBase): # noqa: F405
|
|
67
|
+
path: str = Field(title='Path')
|
|
68
|
+
condition: str = Field(title='Condition')
|
|
69
|
+
value: Any = Field(default=None, title='Value')
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class Condition(FrontendConfigSkipNoneBase): # noqa: F405
|
|
73
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
74
|
+
operation: Literal['and', 'or', 'not'] = Field(title='Operation')
|
|
75
|
+
conditions: list[ConditionItem] = Field(title='Conditions') # noqa: F405
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
Condition.model_rebuild()
|
|
79
|
+
|
|
19
80
|
|
|
20
81
|
class FrontendControlConfig(FrontendConfigSkipNoneBase): # noqa: F405
|
|
21
82
|
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
22
|
-
|
|
83
|
+
id: str | None = Field(None, title='ID')
|
|
84
|
+
type: ConfigType = Field(title='Type')
|
|
23
85
|
name: str = Field(title='Name')
|
|
24
86
|
label: str | None = Field(None, title='Label')
|
|
25
87
|
required: bool | None = Field(None, title='Required')
|
|
26
88
|
hideLabel: bool | None = Field(None, title='Hide Label') # noqa: N815
|
|
27
|
-
actions: list[
|
|
89
|
+
actions: list[ActionType] | None = Field(None, title='Actions') # noqa: F405
|
|
28
90
|
validators: list['FrontendConfigValidator'] | None = Field(None, title='Validators') # noqa: F405
|
|
29
91
|
asyncValidators: list['FrontendConfigAsyncValidator'] | None = Field( # noqa: F405, N815
|
|
30
92
|
None,
|
|
@@ -42,46 +104,7 @@ class FrontendControlConfig(FrontendConfigSkipNoneBase): # noqa: F405
|
|
|
42
104
|
customLabel: list[str] | None = Field(None, title='Custom Label') # noqa: N815
|
|
43
105
|
control: Optional['FrontendControlConfig'] = Field(None, title='Control')
|
|
44
106
|
entityType: str | None = Field(None, title='Entity Type') # noqa: N815
|
|
107
|
+
condition: Condition | None = Field(None, title='Condition') # noqa: F405
|
|
108
|
+
|
|
45
109
|
|
|
46
|
-
|
|
47
|
-
@classmethod
|
|
48
|
-
def validate_value_in_options_type(cls: type, value: Any) -> Any: # type: ignore # noqa: A003
|
|
49
|
-
return validate_options(
|
|
50
|
-
value,
|
|
51
|
-
options=[
|
|
52
|
-
'Bytes',
|
|
53
|
-
'array',
|
|
54
|
-
'checkbox',
|
|
55
|
-
'date',
|
|
56
|
-
'dateTriplet',
|
|
57
|
-
'datetime',
|
|
58
|
-
'dict',
|
|
59
|
-
'dropzone',
|
|
60
|
-
'email',
|
|
61
|
-
'file',
|
|
62
|
-
'group',
|
|
63
|
-
'group_switch',
|
|
64
|
-
'group_toggle',
|
|
65
|
-
'info-group',
|
|
66
|
-
'infoscreen',
|
|
67
|
-
'multiselect',
|
|
68
|
-
'number',
|
|
69
|
-
'number-operations',
|
|
70
|
-
'number-slider',
|
|
71
|
-
'number_equals',
|
|
72
|
-
'number_initial',
|
|
73
|
-
'number_minus',
|
|
74
|
-
'number_plus',
|
|
75
|
-
'object',
|
|
76
|
-
'object_group',
|
|
77
|
-
'object_latest',
|
|
78
|
-
'password',
|
|
79
|
-
'phone',
|
|
80
|
-
'radio',
|
|
81
|
-
'select',
|
|
82
|
-
'text',
|
|
83
|
-
'textarea',
|
|
84
|
-
'time',
|
|
85
|
-
'toggle',
|
|
86
|
-
],
|
|
87
|
-
)
|
|
110
|
+
FrontendControlConfig.model_rebuild()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
amsdal/manager.pyi
CHANGED
|
@@ -5,6 +5,7 @@ from amsdal.configs.main import settings as settings
|
|
|
5
5
|
from amsdal.errors import AmsdalAuthenticationError as AmsdalAuthenticationError, AmsdalMissingCredentialsError as AmsdalMissingCredentialsError, AmsdalRuntimeError as AmsdalRuntimeError, AmsdalSignupError as AmsdalSignupError
|
|
6
6
|
from amsdal.fixtures.manager import AsyncFixturesManager as AsyncFixturesManager, FixturesManager as FixturesManager
|
|
7
7
|
from amsdal.mixins.class_versions_mixin import ClassVersionsMixin as ClassVersionsMixin
|
|
8
|
+
from amsdal_data.transactions.decorators import async_transaction, transaction
|
|
8
9
|
from amsdal_models.classes.class_manager import ClassManager
|
|
9
10
|
from amsdal_utils.config.data_models.amsdal_config import AmsdalConfig as AmsdalConfig
|
|
10
11
|
from amsdal_utils.utils.singleton import Singleton
|
|
@@ -69,6 +70,7 @@ class AmsdalManager(ClassVersionsMixin, metaclass=Singleton):
|
|
|
69
70
|
Returns:
|
|
70
71
|
None
|
|
71
72
|
"""
|
|
73
|
+
@transaction
|
|
72
74
|
def post_setup(self) -> None:
|
|
73
75
|
"""
|
|
74
76
|
Registers internal classes and prepares connections (creates internal tables).
|
|
@@ -98,6 +100,7 @@ class AmsdalManager(ClassVersionsMixin, metaclass=Singleton):
|
|
|
98
100
|
Returns:
|
|
99
101
|
None
|
|
100
102
|
"""
|
|
103
|
+
@transaction
|
|
101
104
|
def apply_fixtures(self) -> None:
|
|
102
105
|
"""
|
|
103
106
|
Loads and applies fixtures defined in your application.
|
|
@@ -194,6 +197,7 @@ class AsyncAmsdalManager(ClassVersionsMixin, metaclass=Singleton):
|
|
|
194
197
|
Returns:
|
|
195
198
|
None
|
|
196
199
|
"""
|
|
200
|
+
@async_transaction
|
|
197
201
|
async def post_setup(self) -> None:
|
|
198
202
|
"""
|
|
199
203
|
Registers internal classes and prepares connections (creates internal tables).
|
|
@@ -223,6 +227,7 @@ class AsyncAmsdalManager(ClassVersionsMixin, metaclass=Singleton):
|
|
|
223
227
|
Returns:
|
|
224
228
|
None
|
|
225
229
|
"""
|
|
230
|
+
@async_transaction
|
|
226
231
|
async def apply_fixtures(self) -> None:
|
|
227
232
|
"""
|
|
228
233
|
Loads and applies fixtures defined in your application.
|
|
Binary file
|
|
Binary file
|
|
@@ -9,21 +9,22 @@ from pydantic.fields import Field
|
|
|
9
9
|
from pydantic.functional_validators import field_validator
|
|
10
10
|
|
|
11
11
|
from amsdal.models.core.class_property import * # noqa: F403
|
|
12
|
+
from amsdal.models.core.storage_metadata import * # noqa: F403
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class ClassObject(Model):
|
|
15
16
|
__module_type__: ClassVar[ModuleType] = ModuleType.CORE
|
|
17
|
+
title: str = Field(title='Title')
|
|
18
|
+
type: str = Field(title='Type')
|
|
19
|
+
module_type: str = Field(title='Module Type')
|
|
16
20
|
properties: Optional[dict[str, Optional['ClassProperty']]] = Field(None, title='Properties') # noqa: F405, UP007
|
|
17
|
-
table_name: Optional[str] = Field(None, title='Table name') # noqa: UP007
|
|
18
|
-
primary_key: Optional[list[str]] = Field(None, title='Primary key fields') # noqa: UP007
|
|
19
|
-
indexed: Optional[list[str]] = Field(None, title='Indexed') # noqa: UP007
|
|
20
|
-
unique: Optional[list[list[str]]] = Field(None, title='Unique Fields') # noqa: UP007
|
|
21
21
|
required: Optional[list[str]] = Field(None, title='Required') # noqa: UP007
|
|
22
|
-
|
|
22
|
+
custom_code: str | None = Field(None, title='Custom Code')
|
|
23
|
+
storage_metadata: Optional['StorageMetadata'] = Field(None, title='Storage metadata') # noqa: F405
|
|
23
24
|
|
|
24
25
|
@field_validator('properties')
|
|
25
26
|
@classmethod
|
|
26
|
-
def _non_empty_keys_properties(cls: type, value: Any) -> Any:
|
|
27
|
+
def _non_empty_keys_properties(cls: type, value: Any) -> Any: # type: ignore # noqa: A003
|
|
27
28
|
return validate_non_empty_keys(value)
|
|
28
29
|
|
|
29
30
|
@property
|
|
@@ -7,12 +7,18 @@ from amsdal_utils.models.enums import ModuleType
|
|
|
7
7
|
from pydantic.fields import Field
|
|
8
8
|
from pydantic.functional_validators import field_validator
|
|
9
9
|
|
|
10
|
+
from amsdal.models.core.option import * # noqa: F403
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
class ClassProperty(TypeModel):
|
|
12
14
|
__module_type__: ClassVar[ModuleType] = ModuleType.CORE
|
|
15
|
+
title: str | None = Field(None, title='Title')
|
|
13
16
|
type: str = Field(title='Type')
|
|
17
|
+
default: Any | None = Field(None, title='Default')
|
|
18
|
+
options: list['Option'] | None = Field(None, title='Options') # noqa: F405
|
|
14
19
|
items: dict[str, Any | None] | None = Field(None, title='Items')
|
|
15
|
-
|
|
20
|
+
discriminator: str | None = Field(None, title='Discriminator')
|
|
21
|
+
extra: dict[str, Any | None] = Field(default_factory=dict, title='Extra')
|
|
16
22
|
|
|
17
23
|
@field_validator('items')
|
|
18
24
|
@classmethod
|