amsdal 0.4.10__cp311-cp311-macosx_10_9_universal2.whl → 0.5.29__cp311-cp311-macosx_10_9_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.
Files changed (163) hide show
  1. amsdal/Third-Party Materials - AMSDAL Dependencies - License Notices.md +28 -0
  2. amsdal/__about__.py +1 -1
  3. amsdal/__migrations__/0000_initial.py +22 -203
  4. amsdal/__migrations__/0001_create_class_file.py +61 -0
  5. amsdal/__migrations__/0002_create_class_file.py +109 -0
  6. amsdal/__migrations__/0003_update_class_file.py +91 -0
  7. amsdal/__migrations__/0004_update_class_file.py +45 -0
  8. amsdal/cloud/__init__.cpython-311-darwin.so +0 -0
  9. amsdal/cloud/client.cpython-311-darwin.so +0 -0
  10. amsdal/cloud/constants.cpython-311-darwin.so +0 -0
  11. amsdal/cloud/enums.cpython-311-darwin.so +0 -0
  12. amsdal/cloud/models/__init__.cpython-311-darwin.so +0 -0
  13. amsdal/cloud/models/base.cpython-311-darwin.so +0 -0
  14. amsdal/cloud/services/__init__.cpython-311-darwin.so +0 -0
  15. amsdal/cloud/services/actions/__init__.cpython-311-darwin.so +0 -0
  16. amsdal/cloud/services/actions/add_allowlist_ip.cpython-311-darwin.so +0 -0
  17. amsdal/cloud/services/actions/add_basic_auth.cpython-311-darwin.so +0 -0
  18. amsdal/cloud/services/actions/add_dependency.cpython-311-darwin.so +0 -0
  19. amsdal/cloud/services/actions/add_secret.cpython-311-darwin.so +0 -0
  20. amsdal/cloud/services/actions/base.cpython-311-darwin.so +0 -0
  21. amsdal/cloud/services/actions/create_deploy.cpython-311-darwin.so +0 -0
  22. amsdal/cloud/services/actions/create_env.cpython-311-darwin.so +0 -0
  23. amsdal/cloud/services/actions/create_session.cpython-311-darwin.so +0 -0
  24. amsdal/cloud/services/actions/delete_allowlist_ip.cpython-311-darwin.so +0 -0
  25. amsdal/cloud/services/actions/delete_basic_auth.cpython-311-darwin.so +0 -0
  26. amsdal/cloud/services/actions/delete_dependency.cpython-311-darwin.so +0 -0
  27. amsdal/cloud/services/actions/delete_env.cpython-311-darwin.so +0 -0
  28. amsdal/cloud/services/actions/delete_secret.cpython-311-darwin.so +0 -0
  29. amsdal/cloud/services/actions/destroy_deploy.cpython-311-darwin.so +0 -0
  30. amsdal/cloud/services/actions/expose_db.cpython-311-darwin.so +0 -0
  31. amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-311-darwin.so +0 -0
  32. amsdal/cloud/services/actions/get_monitoring_info.cpython-311-darwin.so +0 -0
  33. amsdal/cloud/services/actions/list_dependencies.cpython-311-darwin.so +0 -0
  34. amsdal/cloud/services/actions/list_deploys.cpython-311-darwin.so +0 -0
  35. amsdal/cloud/services/actions/list_envs.cpython-311-darwin.so +0 -0
  36. amsdal/cloud/services/actions/list_secrets.cpython-311-darwin.so +0 -0
  37. amsdal/cloud/services/actions/manager.cpython-311-darwin.so +0 -0
  38. amsdal/cloud/services/actions/signup_action.cpython-311-darwin.so +0 -0
  39. amsdal/cloud/services/actions/update_deploy.cpython-311-darwin.so +0 -0
  40. amsdal/cloud/services/auth/__init__.cpython-311-darwin.so +0 -0
  41. amsdal/cloud/services/auth/base.cpython-311-darwin.so +0 -0
  42. amsdal/cloud/services/auth/credentials.cpython-311-darwin.so +0 -0
  43. amsdal/cloud/services/auth/manager.cpython-311-darwin.so +0 -0
  44. amsdal/cloud/services/auth/signup_service.cpython-311-darwin.so +0 -0
  45. amsdal/cloud/services/auth/token.cpython-311-darwin.so +0 -0
  46. amsdal/configs/main.py +17 -1
  47. amsdal/configs/main.pyi +7 -3
  48. amsdal/contrib/__init__.cpython-311-darwin.so +0 -0
  49. amsdal/contrib/auth/errors.py +36 -0
  50. amsdal/contrib/auth/errors.pyi +12 -0
  51. amsdal/contrib/auth/lifecycle/consumer.py +3 -3
  52. amsdal/contrib/auth/lifecycle/consumer.pyi +3 -0
  53. amsdal/contrib/auth/migrations/0000_initial.py +55 -52
  54. amsdal/contrib/auth/migrations/0001_add_mfa_support.py +188 -0
  55. amsdal/contrib/auth/models/__init__.py +1 -0
  56. amsdal/contrib/auth/models/backup_code.py +85 -0
  57. amsdal/contrib/auth/models/email_mfa_device.py +108 -0
  58. amsdal/contrib/auth/models/login_session.py +117 -0
  59. amsdal/contrib/auth/models/mfa_device.py +86 -0
  60. amsdal/contrib/auth/models/sms_device.py +113 -0
  61. amsdal/contrib/auth/models/totp_device.py +58 -0
  62. amsdal/contrib/auth/models/user.py +50 -0
  63. amsdal/contrib/auth/services/__init__.py +1 -0
  64. amsdal/contrib/auth/services/mfa_device_service.py +544 -0
  65. amsdal/contrib/auth/services/mfa_device_service.pyi +216 -0
  66. amsdal/contrib/auth/services/totp_service.py +358 -0
  67. amsdal/contrib/auth/services/totp_service.pyi +158 -0
  68. amsdal/contrib/auth/settings.py +8 -0
  69. amsdal/contrib/auth/settings.pyi +8 -0
  70. amsdal/contrib/auth/transactions/__init__.py +1 -0
  71. amsdal/contrib/auth/transactions/mfa_device_transactions.py +463 -0
  72. amsdal/contrib/auth/transactions/mfa_device_transactions.pyi +226 -0
  73. amsdal/contrib/auth/transactions/totp_transactions.py +206 -0
  74. amsdal/contrib/auth/transactions/totp_transactions.pyi +113 -0
  75. amsdal/contrib/auth/utils/mfa.py +257 -0
  76. amsdal/contrib/auth/utils/mfa.pyi +119 -0
  77. amsdal/contrib/frontend_configs/conversion/convert.py +32 -5
  78. amsdal/contrib/frontend_configs/migrations/0000_initial.py +154 -183
  79. amsdal/contrib/frontend_configs/migrations/0001_update_frontend_control_config.py +245 -0
  80. amsdal/contrib/frontend_configs/migrations/0002_add_button_and_invoke_actions.py +352 -0
  81. amsdal/contrib/frontend_configs/migrations/0003_create_class_frontendconfigdashboardelement.py +145 -0
  82. amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +57 -1
  83. amsdal/contrib/frontend_configs/models/frontend_config_dashboard.py +51 -0
  84. amsdal/contrib/frontend_configs/models/frontend_control_config.py +69 -46
  85. amsdal/fixtures/__init__.cpython-311-darwin.so +0 -0
  86. amsdal/fixtures/manager.cpython-311-darwin.so +0 -0
  87. amsdal/fixtures/utils.cpython-311-darwin.so +0 -0
  88. amsdal/manager.cpython-311-darwin.so +0 -0
  89. amsdal/manager.pyi +5 -0
  90. amsdal/mixins/__init__.cpython-311-darwin.so +0 -0
  91. amsdal/mixins/class_versions_mixin.cpython-311-darwin.so +0 -0
  92. amsdal/models/core/class_object.py +7 -6
  93. amsdal/models/core/class_property.py +7 -1
  94. amsdal/models/core/file.py +168 -81
  95. amsdal/models/core/storage_metadata.py +15 -0
  96. amsdal/models/mixins.py +31 -0
  97. amsdal/models/types/object.py +3 -3
  98. amsdal/schemas/core/class_object/model.json +20 -0
  99. amsdal/schemas/core/class_property/model.json +19 -0
  100. amsdal/schemas/core/file/properties/validate_data.py +2 -3
  101. amsdal/schemas/core/storage_metadata/model.json +52 -0
  102. amsdal/schemas/interfaces.pyi +1 -1
  103. amsdal/schemas/manager.cpython-311-darwin.so +0 -0
  104. amsdal/schemas/mixins/check_dependencies_mixin.py +23 -8
  105. amsdal/schemas/mixins/check_dependencies_mixin.pyi +5 -2
  106. amsdal/schemas/utils.pyi +2 -2
  107. amsdal/services/__init__.py +11 -0
  108. amsdal/services/__init__.pyi +4 -0
  109. amsdal/services/external_connections.py +262 -0
  110. amsdal/services/external_connections.pyi +190 -0
  111. amsdal/services/external_model_generator.py +350 -0
  112. amsdal/services/external_model_generator.pyi +134 -0
  113. amsdal/services/transaction_execution.cpython-311-darwin.so +0 -0
  114. amsdal/services/transaction_execution.pyi +1 -0
  115. amsdal/storages/__init__.py +20 -0
  116. amsdal/storages/__init__.pyi +8 -0
  117. amsdal/storages/file_system.py +214 -0
  118. amsdal/storages/file_system.pyi +36 -0
  119. amsdal/utils/rollback/__init__.pyi +6 -0
  120. amsdal/utils/tests/enums.py +0 -2
  121. amsdal/utils/tests/helpers.py +213 -381
  122. amsdal/utils/tests/migrations.py +157 -0
  123. {amsdal-0.4.10.dist-info → amsdal-0.5.29.dist-info}/METADATA +13 -8
  124. {amsdal-0.4.10.dist-info → amsdal-0.5.29.dist-info}/RECORD +131 -124
  125. {amsdal-0.4.10.dist-info → amsdal-0.5.29.dist-info}/WHEEL +1 -1
  126. amsdal/__migrations__/0001_datetime_type.py +0 -18
  127. amsdal/__migrations__/0002_fixture_order.py +0 -44
  128. amsdal/__migrations__/0003_schema_type_in_class_meta.py +0 -44
  129. amsdal/contrib/auth/models/login_session.pyi +0 -37
  130. amsdal/contrib/auth/models/permission.pyi +0 -18
  131. amsdal/contrib/auth/models/user.pyi +0 -46
  132. amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +0 -12
  133. amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +0 -7
  134. amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +0 -32
  135. amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +0 -11
  136. amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +0 -8
  137. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +0 -8
  138. amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +0 -9
  139. amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +0 -10
  140. amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +0 -15
  141. amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +0 -35
  142. amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +0 -9
  143. amsdal/models/__init__.pyi +0 -9
  144. amsdal/models/core/class_object.pyi +0 -24
  145. amsdal/models/core/class_object_meta.py +0 -26
  146. amsdal/models/core/class_object_meta.pyi +0 -15
  147. amsdal/models/core/class_property.pyi +0 -11
  148. amsdal/models/core/class_property_meta.py +0 -15
  149. amsdal/models/core/class_property_meta.pyi +0 -10
  150. amsdal/models/core/file.pyi +0 -104
  151. amsdal/models/core/fixture.pyi +0 -14
  152. amsdal/models/core/option.pyi +0 -8
  153. amsdal/models/core/validator.pyi +0 -8
  154. amsdal/models/types/object.pyi +0 -16
  155. amsdal/schemas/core/class_object_meta/model.json +0 -59
  156. amsdal/schemas/core/class_property_meta/model.json +0 -23
  157. amsdal/services/__init__.cpython-311-darwin.so +0 -0
  158. /amsdal/contrib/auth/{models → services}/__init__.pyi +0 -0
  159. /amsdal/contrib/{frontend_configs/models → auth/transactions}/__init__.pyi +0 -0
  160. /amsdal/{models/core/__init__.pyi → contrib/auth/utils/__init__.py} +0 -0
  161. /amsdal/{models/types → contrib/auth/utils}/__init__.pyi +0 -0
  162. {amsdal-0.4.10.dist-info → amsdal-0.5.29.dist-info}/licenses/LICENSE.txt +0 -0
  163. {amsdal-0.4.10.dist-info → amsdal-0.5.29.dist-info}/top_level.txt +0 -0
@@ -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
- type: str = Field(title='Type')
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['FrontendConfigControlAction'] | None = Field(None, title='Actions') # noqa: F405
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
- @field_validator('type')
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
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.
@@ -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
- meta_class: Optional[str] = Field('ClassObject', title='Meta Class') # noqa: UP007
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
- db_field: list[str] | None = Field(None, title='DB Fields')
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