amsdal 0.5.23__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.

Potentially problematic release.


This version of amsdal might be problematic. Click here for more details.

Files changed (252) hide show
  1. amsdal/Third-Party Materials - AMSDAL Dependencies - License Notices.md +1334 -0
  2. amsdal/__about__.py +4 -0
  3. amsdal/__about__.pyi +1 -0
  4. amsdal/__init__.py +23 -0
  5. amsdal/__init__.pyi +9 -0
  6. amsdal/__migrations__/0000_initial.py +36 -0
  7. amsdal/__migrations__/0001_create_class_file.py +61 -0
  8. amsdal/__migrations__/0002_create_class_file.py +109 -0
  9. amsdal/__migrations__/0003_update_class_file.py +91 -0
  10. amsdal/__migrations__/0004_update_class_file.py +45 -0
  11. amsdal/cloud/__init__.cpython-311-darwin.so +0 -0
  12. amsdal/cloud/__init__.pyi +0 -0
  13. amsdal/cloud/client.cpython-311-darwin.so +0 -0
  14. amsdal/cloud/client.pyi +57 -0
  15. amsdal/cloud/constants.cpython-311-darwin.so +0 -0
  16. amsdal/cloud/constants.pyi +13 -0
  17. amsdal/cloud/enums.cpython-311-darwin.so +0 -0
  18. amsdal/cloud/enums.pyi +68 -0
  19. amsdal/cloud/models/__init__.cpython-311-darwin.so +0 -0
  20. amsdal/cloud/models/__init__.pyi +0 -0
  21. amsdal/cloud/models/base.cpython-311-darwin.so +0 -0
  22. amsdal/cloud/models/base.pyi +247 -0
  23. amsdal/cloud/services/__init__.cpython-311-darwin.so +0 -0
  24. amsdal/cloud/services/__init__.pyi +0 -0
  25. amsdal/cloud/services/actions/__init__.cpython-311-darwin.so +0 -0
  26. amsdal/cloud/services/actions/__init__.pyi +0 -0
  27. amsdal/cloud/services/actions/add_allowlist_ip.cpython-311-darwin.so +0 -0
  28. amsdal/cloud/services/actions/add_allowlist_ip.pyi +19 -0
  29. amsdal/cloud/services/actions/add_basic_auth.cpython-311-darwin.so +0 -0
  30. amsdal/cloud/services/actions/add_basic_auth.pyi +21 -0
  31. amsdal/cloud/services/actions/add_dependency.cpython-311-darwin.so +0 -0
  32. amsdal/cloud/services/actions/add_dependency.pyi +19 -0
  33. amsdal/cloud/services/actions/add_secret.cpython-311-darwin.so +0 -0
  34. amsdal/cloud/services/actions/add_secret.pyi +20 -0
  35. amsdal/cloud/services/actions/base.cpython-311-darwin.so +0 -0
  36. amsdal/cloud/services/actions/base.pyi +122 -0
  37. amsdal/cloud/services/actions/create_deploy.cpython-311-darwin.so +0 -0
  38. amsdal/cloud/services/actions/create_deploy.pyi +41 -0
  39. amsdal/cloud/services/actions/create_env.cpython-311-darwin.so +0 -0
  40. amsdal/cloud/services/actions/create_env.pyi +19 -0
  41. amsdal/cloud/services/actions/create_session.cpython-311-darwin.so +0 -0
  42. amsdal/cloud/services/actions/create_session.pyi +17 -0
  43. amsdal/cloud/services/actions/delete_allowlist_ip.cpython-311-darwin.so +0 -0
  44. amsdal/cloud/services/actions/delete_allowlist_ip.pyi +19 -0
  45. amsdal/cloud/services/actions/delete_basic_auth.cpython-311-darwin.so +0 -0
  46. amsdal/cloud/services/actions/delete_basic_auth.pyi +20 -0
  47. amsdal/cloud/services/actions/delete_dependency.cpython-311-darwin.so +0 -0
  48. amsdal/cloud/services/actions/delete_dependency.pyi +21 -0
  49. amsdal/cloud/services/actions/delete_env.cpython-311-darwin.so +0 -0
  50. amsdal/cloud/services/actions/delete_env.pyi +21 -0
  51. amsdal/cloud/services/actions/delete_secret.cpython-311-darwin.so +0 -0
  52. amsdal/cloud/services/actions/delete_secret.pyi +21 -0
  53. amsdal/cloud/services/actions/destroy_deploy.cpython-311-darwin.so +0 -0
  54. amsdal/cloud/services/actions/destroy_deploy.pyi +18 -0
  55. amsdal/cloud/services/actions/expose_db.cpython-311-darwin.so +0 -0
  56. amsdal/cloud/services/actions/expose_db.pyi +22 -0
  57. amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-311-darwin.so +0 -0
  58. amsdal/cloud/services/actions/get_basic_auth_credentials.pyi +21 -0
  59. amsdal/cloud/services/actions/get_monitoring_info.cpython-311-darwin.so +0 -0
  60. amsdal/cloud/services/actions/get_monitoring_info.pyi +21 -0
  61. amsdal/cloud/services/actions/list_dependencies.cpython-311-darwin.so +0 -0
  62. amsdal/cloud/services/actions/list_dependencies.pyi +21 -0
  63. amsdal/cloud/services/actions/list_deploys.cpython-311-darwin.so +0 -0
  64. amsdal/cloud/services/actions/list_deploys.pyi +19 -0
  65. amsdal/cloud/services/actions/list_envs.cpython-311-darwin.so +0 -0
  66. amsdal/cloud/services/actions/list_envs.pyi +20 -0
  67. amsdal/cloud/services/actions/list_secrets.cpython-311-darwin.so +0 -0
  68. amsdal/cloud/services/actions/list_secrets.pyi +22 -0
  69. amsdal/cloud/services/actions/manager.cpython-311-darwin.so +0 -0
  70. amsdal/cloud/services/actions/manager.pyi +278 -0
  71. amsdal/cloud/services/actions/signup_action.cpython-311-darwin.so +0 -0
  72. amsdal/cloud/services/actions/signup_action.pyi +20 -0
  73. amsdal/cloud/services/actions/update_deploy.cpython-311-darwin.so +0 -0
  74. amsdal/cloud/services/actions/update_deploy.pyi +19 -0
  75. amsdal/cloud/services/auth/__init__.cpython-311-darwin.so +0 -0
  76. amsdal/cloud/services/auth/__init__.pyi +0 -0
  77. amsdal/cloud/services/auth/base.cpython-311-darwin.so +0 -0
  78. amsdal/cloud/services/auth/base.pyi +6 -0
  79. amsdal/cloud/services/auth/credentials.cpython-311-darwin.so +0 -0
  80. amsdal/cloud/services/auth/credentials.pyi +30 -0
  81. amsdal/cloud/services/auth/manager.cpython-311-darwin.so +0 -0
  82. amsdal/cloud/services/auth/manager.pyi +26 -0
  83. amsdal/cloud/services/auth/signup_service.cpython-311-darwin.so +0 -0
  84. amsdal/cloud/services/auth/signup_service.pyi +32 -0
  85. amsdal/cloud/services/auth/token.cpython-311-darwin.so +0 -0
  86. amsdal/cloud/services/auth/token.pyi +27 -0
  87. amsdal/configs/__init__.py +0 -0
  88. amsdal/configs/__init__.pyi +0 -0
  89. amsdal/configs/constants.py +33 -0
  90. amsdal/configs/constants.pyi +22 -0
  91. amsdal/configs/main.py +274 -0
  92. amsdal/configs/main.pyi +178 -0
  93. amsdal/context/__init__.py +0 -0
  94. amsdal/context/__init__.pyi +0 -0
  95. amsdal/context/manager.py +69 -0
  96. amsdal/context/manager.pyi +50 -0
  97. amsdal/contrib/__init__.cpython-311-darwin.so +0 -0
  98. amsdal/contrib/__init__.pyi +0 -0
  99. amsdal/contrib/app_config.py +7 -0
  100. amsdal/contrib/app_config.pyi +6 -0
  101. amsdal/contrib/auth/__init__.py +0 -0
  102. amsdal/contrib/auth/__init__.pyi +0 -0
  103. amsdal/contrib/auth/app.py +27 -0
  104. amsdal/contrib/auth/app.pyi +15 -0
  105. amsdal/contrib/auth/decorators/__init__.py +35 -0
  106. amsdal/contrib/auth/decorators/__init__.pyi +6 -0
  107. amsdal/contrib/auth/errors.py +7 -0
  108. amsdal/contrib/auth/errors.pyi +4 -0
  109. amsdal/contrib/auth/fixtures/basic_permissions.json +64 -0
  110. amsdal/contrib/auth/lifecycle/__init__.py +0 -0
  111. amsdal/contrib/auth/lifecycle/__init__.pyi +0 -0
  112. amsdal/contrib/auth/lifecycle/consumer.py +394 -0
  113. amsdal/contrib/auth/lifecycle/consumer.pyi +108 -0
  114. amsdal/contrib/auth/migrations/0000_initial.py +87 -0
  115. amsdal/contrib/auth/models/__init__.py +0 -0
  116. amsdal/contrib/auth/models/login_session.py +118 -0
  117. amsdal/contrib/auth/models/permission.py +23 -0
  118. amsdal/contrib/auth/models/user.py +106 -0
  119. amsdal/contrib/auth/settings.py +36 -0
  120. amsdal/contrib/auth/settings.pyi +26 -0
  121. amsdal/contrib/frontend_configs/__init__.py +0 -0
  122. amsdal/contrib/frontend_configs/__init__.pyi +0 -0
  123. amsdal/contrib/frontend_configs/app.py +24 -0
  124. amsdal/contrib/frontend_configs/app.pyi +19 -0
  125. amsdal/contrib/frontend_configs/constants.py +1 -0
  126. amsdal/contrib/frontend_configs/constants.pyi +1 -0
  127. amsdal/contrib/frontend_configs/conversion/__init__.py +5 -0
  128. amsdal/contrib/frontend_configs/conversion/__init__.pyi +3 -0
  129. amsdal/contrib/frontend_configs/conversion/convert.py +310 -0
  130. amsdal/contrib/frontend_configs/conversion/convert.pyi +22 -0
  131. amsdal/contrib/frontend_configs/lifecycle/__init__.py +0 -0
  132. amsdal/contrib/frontend_configs/lifecycle/__init__.pyi +0 -0
  133. amsdal/contrib/frontend_configs/lifecycle/consumer.py +306 -0
  134. amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +98 -0
  135. amsdal/contrib/frontend_configs/migrations/0000_initial.py +227 -0
  136. amsdal/contrib/frontend_configs/migrations/0001_update_frontend_control_config.py +245 -0
  137. amsdal/contrib/frontend_configs/migrations/0002_add_button_and_invoke_actions.py +352 -0
  138. amsdal/contrib/frontend_configs/models/__init__.py +0 -0
  139. amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
  140. amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
  141. amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +110 -0
  142. amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
  143. amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
  144. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
  145. amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
  146. amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
  147. amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
  148. amsdal/contrib/frontend_configs/models/frontend_control_config.py +108 -0
  149. amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
  150. amsdal/contrib/frontend_configs/utils.py +29 -0
  151. amsdal/contrib/frontend_configs/utils.pyi +17 -0
  152. amsdal/errors.py +31 -0
  153. amsdal/errors.pyi +12 -0
  154. amsdal/fixtures/__init__.cpython-311-darwin.so +0 -0
  155. amsdal/fixtures/__init__.pyi +0 -0
  156. amsdal/fixtures/manager.cpython-311-darwin.so +0 -0
  157. amsdal/fixtures/manager.pyi +170 -0
  158. amsdal/fixtures/utils.cpython-311-darwin.so +0 -0
  159. amsdal/fixtures/utils.pyi +9 -0
  160. amsdal/manager.cpython-311-darwin.so +0 -0
  161. amsdal/manager.pyi +265 -0
  162. amsdal/mixins/__init__.cpython-311-darwin.so +0 -0
  163. amsdal/mixins/__init__.pyi +0 -0
  164. amsdal/mixins/class_versions_mixin.cpython-311-darwin.so +0 -0
  165. amsdal/mixins/class_versions_mixin.pyi +12 -0
  166. amsdal/models/__init__.py +19 -0
  167. amsdal/models/core/__init__.py +0 -0
  168. amsdal/models/core/class_object.py +38 -0
  169. amsdal/models/core/class_property.py +26 -0
  170. amsdal/models/core/file.py +243 -0
  171. amsdal/models/core/fixture.py +25 -0
  172. amsdal/models/core/option.py +11 -0
  173. amsdal/models/core/storage_metadata.py +15 -0
  174. amsdal/models/core/validator.py +12 -0
  175. amsdal/models/mixins.py +31 -0
  176. amsdal/models/types/__init__.py +0 -0
  177. amsdal/models/types/object.py +26 -0
  178. amsdal/py.typed +0 -0
  179. amsdal/queryset/__init__.py +21 -0
  180. amsdal/queryset/__init__.pyi +6 -0
  181. amsdal/schemas/__init__.py +0 -0
  182. amsdal/schemas/__init__.pyi +0 -0
  183. amsdal/schemas/core/class_object/model.json +51 -0
  184. amsdal/schemas/core/class_object/properties/display_name.py +9 -0
  185. amsdal/schemas/core/class_property/model.json +41 -0
  186. amsdal/schemas/core/file/hooks/pre_create.py +24 -0
  187. amsdal/schemas/core/file/hooks/pre_update.py +24 -0
  188. amsdal/schemas/core/file/model.json +23 -0
  189. amsdal/schemas/core/file/properties/from_file.py +34 -0
  190. amsdal/schemas/core/file/properties/mimetype.py +13 -0
  191. amsdal/schemas/core/file/properties/str.py +6 -0
  192. amsdal/schemas/core/file/properties/to_file.py +24 -0
  193. amsdal/schemas/core/file/properties/validate_data.py +31 -0
  194. amsdal/schemas/core/fixture/model.json +35 -0
  195. amsdal/schemas/core/option/model.json +19 -0
  196. amsdal/schemas/core/storage_metadata/model.json +52 -0
  197. amsdal/schemas/core/validator/model.json +19 -0
  198. amsdal/schemas/interfaces.py +25 -0
  199. amsdal/schemas/interfaces.pyi +20 -0
  200. amsdal/schemas/manager.cpython-311-darwin.so +0 -0
  201. amsdal/schemas/manager.py +0 -0
  202. amsdal/schemas/manager.pyi +0 -0
  203. amsdal/schemas/mixins/__init__.py +0 -0
  204. amsdal/schemas/mixins/__init__.pyi +0 -0
  205. amsdal/schemas/mixins/check_dependencies_mixin.py +130 -0
  206. amsdal/schemas/mixins/check_dependencies_mixin.pyi +45 -0
  207. amsdal/schemas/mixins/verify_schemas_mixin.py +96 -0
  208. amsdal/schemas/mixins/verify_schemas_mixin.pyi +33 -0
  209. amsdal/schemas/repository.py +84 -0
  210. amsdal/schemas/repository.pyi +22 -0
  211. amsdal/schemas/types/anything/model.json +7 -0
  212. amsdal/schemas/types/array/model.json +7 -0
  213. amsdal/schemas/types/binary/model.json +7 -0
  214. amsdal/schemas/types/boolean/model.json +17 -0
  215. amsdal/schemas/types/date/model.json +7 -0
  216. amsdal/schemas/types/datetime/model.json +7 -0
  217. amsdal/schemas/types/dictionary/model.json +8 -0
  218. amsdal/schemas/types/number/model.json +8 -0
  219. amsdal/schemas/types/object/model.json +53 -0
  220. amsdal/schemas/types/string/model.json +8 -0
  221. amsdal/schemas/utils.py +16 -0
  222. amsdal/schemas/utils.pyi +10 -0
  223. amsdal/services/__init__.py +11 -0
  224. amsdal/services/__init__.pyi +4 -0
  225. amsdal/services/external_connections.py +262 -0
  226. amsdal/services/external_connections.pyi +190 -0
  227. amsdal/services/external_model_generator.py +350 -0
  228. amsdal/services/external_model_generator.pyi +134 -0
  229. amsdal/services/transaction_execution.cpython-311-darwin.so +0 -0
  230. amsdal/services/transaction_execution.pyi +93 -0
  231. amsdal/storages/__init__.py +20 -0
  232. amsdal/storages/__init__.pyi +8 -0
  233. amsdal/storages/file_system.py +214 -0
  234. amsdal/storages/file_system.pyi +36 -0
  235. amsdal/transactions/__init__.py +13 -0
  236. amsdal/transactions/__init__.pyi +4 -0
  237. amsdal/utils/__init__.py +0 -0
  238. amsdal/utils/__init__.pyi +0 -0
  239. amsdal/utils/contrib_paths.py +23 -0
  240. amsdal/utils/contrib_paths.pyi +14 -0
  241. amsdal/utils/rollback/__init__.py +440 -0
  242. amsdal/utils/rollback/__init__.pyi +38 -0
  243. amsdal/utils/tests/__init__.py +0 -0
  244. amsdal/utils/tests/enums.py +16 -0
  245. amsdal/utils/tests/factories.py +49 -0
  246. amsdal/utils/tests/helpers.py +331 -0
  247. amsdal/utils/tests/migrations.py +157 -0
  248. amsdal-0.5.23.dist-info/METADATA +373 -0
  249. amsdal-0.5.23.dist-info/RECORD +252 -0
  250. amsdal-0.5.23.dist-info/WHEEL +5 -0
  251. amsdal-0.5.23.dist-info/licenses/LICENSE.txt +107 -0
  252. amsdal-0.5.23.dist-info/top_level.txt +1 -0
@@ -0,0 +1,108 @@
1
+ from typing import TYPE_CHECKING
2
+ from typing import Any
3
+ from typing import ClassVar
4
+ from typing import Literal
5
+ from typing import Optional
6
+
7
+ from amsdal_utils.models.enums import ModuleType
8
+ from pydantic.fields import Field
9
+
10
+ from amsdal.contrib.frontend_configs.models.frontend_activator_config import * # noqa: F403
11
+ from amsdal.contrib.frontend_configs.models.frontend_config_async_validator import * # noqa: F403
12
+ from amsdal.contrib.frontend_configs.models.frontend_config_control_action import * # noqa: F403
13
+ from amsdal.contrib.frontend_configs.models.frontend_config_option import * # noqa: F403
14
+ from amsdal.contrib.frontend_configs.models.frontend_config_skip_none_base import * # noqa: F403
15
+ from amsdal.contrib.frontend_configs.models.frontend_config_slider_option import * # noqa: F403
16
+ from amsdal.contrib.frontend_configs.models.frontend_config_text_mask import * # noqa: F403
17
+ from amsdal.contrib.frontend_configs.models.frontend_config_validator import * # noqa: F403
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
+ 'button',
26
+ 'chat',
27
+ 'checkbox',
28
+ 'date',
29
+ 'dateTriplet',
30
+ 'datetime',
31
+ 'dict',
32
+ 'dropzone',
33
+ 'email',
34
+ 'file',
35
+ 'group',
36
+ 'group_switch',
37
+ 'group_toggle',
38
+ 'info-group',
39
+ 'infoscreen',
40
+ 'multiselect',
41
+ 'number',
42
+ 'number-operations',
43
+ 'number-slider',
44
+ 'number_equals',
45
+ 'number_initial',
46
+ 'number_minus',
47
+ 'number_plus',
48
+ 'object',
49
+ 'object_group',
50
+ 'object_latest',
51
+ 'password',
52
+ 'phone',
53
+ 'radio',
54
+ 'select',
55
+ 'text',
56
+ 'textarea',
57
+ 'time',
58
+ 'toggle',
59
+ 'sections',
60
+ 'section',
61
+ ]
62
+
63
+
64
+ class ConditionItem(FrontendConfigSkipNoneBase): # noqa: F405
65
+ path: str = Field(title='Path')
66
+ condition: str = Field(title='Condition')
67
+ value: Any = Field(default=None, title='Value')
68
+
69
+
70
+ class Condition(FrontendConfigSkipNoneBase): # noqa: F405
71
+ __module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
72
+ operation: Literal['and', 'or', 'not'] = Field(title='Operation')
73
+ conditions: list[ConditionItem] = Field(title='Conditions') # noqa: F405
74
+
75
+
76
+ Condition.model_rebuild()
77
+
78
+
79
+ class FrontendControlConfig(FrontendConfigSkipNoneBase): # noqa: F405
80
+ __module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
81
+ id: str | None = Field(None, title='ID')
82
+ type: ConfigType = Field(title='Type')
83
+ name: str = Field(title='Name')
84
+ label: str | None = Field(None, title='Label')
85
+ required: bool | None = Field(None, title='Required')
86
+ hideLabel: bool | None = Field(None, title='Hide Label') # noqa: N815
87
+ actions: list[ActionType] | None = Field(None, title='Actions') # noqa: F405
88
+ validators: list['FrontendConfigValidator'] | None = Field(None, title='Validators') # noqa: F405
89
+ asyncValidators: list['FrontendConfigAsyncValidator'] | None = Field( # noqa: F405, N815
90
+ None,
91
+ title='Async Validators',
92
+ )
93
+ activators: list['FrontendActivatorConfig'] | None = Field(None, title='Activators') # noqa: F405
94
+ additionalText: str | None = Field(None, title='Additional Text') # noqa: N815
95
+ value: Any | None = Field(None, title='Value')
96
+ placeholder: str | None = Field(None, title='Placeholder')
97
+ options: list['FrontendConfigOption'] | None = Field(None, title='Options') # noqa: F405
98
+ mask: Optional['FrontendConfigTextMask'] = Field(None, title='Mask') # noqa: F405
99
+ controls: list['FrontendControlConfig'] | None = Field(None, title='Controls')
100
+ showSearch: bool | None = Field(None, title='Show Search') # noqa: N815
101
+ sliderOptions: Optional['FrontendConfigSliderOption'] = Field(None, title='Slider Option') # noqa: F405, N815
102
+ customLabel: list[str] | None = Field(None, title='Custom Label') # noqa: N815
103
+ control: Optional['FrontendControlConfig'] = Field(None, title='Control')
104
+ entityType: str | None = Field(None, title='Entity Type') # noqa: N815
105
+ condition: Condition | None = Field(None, title='Condition') # noqa: F405
106
+
107
+
108
+ FrontendControlConfig.model_rebuild()
@@ -0,0 +1,14 @@
1
+ from typing import ClassVar
2
+ from typing import Optional
3
+
4
+ from amsdal_models.classes.model import Model
5
+ from amsdal_utils.models.enums import ModuleType
6
+ from pydantic.fields import Field
7
+
8
+ from amsdal.contrib.frontend_configs.models.frontend_control_config import * # noqa: F403
9
+
10
+
11
+ class FrontendModelConfig(Model):
12
+ __module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
13
+ class_name: str = Field(title='Class Name')
14
+ control: Optional['FrontendControlConfig'] = Field(None, title='Control') # noqa: F405
@@ -0,0 +1,29 @@
1
+ from typing import Any
2
+
3
+
4
+ def merge_ui_configs(base: dict[str, Any], override: dict[str, Any]) -> dict[str, Any]:
5
+ """
6
+ Merges two UI configs together. The override config will take precedence over the base config.
7
+
8
+ This function recursively merges two dictionaries representing UI configurations.
9
+ If a key exists in both dictionaries, the value from the override dictionary will be used.
10
+ If the value is a dictionary or a list, the function will merge them recursively.
11
+
12
+ Args:
13
+ base (dict[str, Any]): The base UI configuration dictionary.
14
+ override (dict[str, Any]): The override UI configuration dictionary.
15
+
16
+ Returns:
17
+ dict[str, Any]: The merged UI configuration dictionary.
18
+ """
19
+ for key, value in override.items():
20
+ if key not in base:
21
+ base[key] = value
22
+ elif isinstance(value, dict):
23
+ base[key] = merge_ui_configs(base[key], value)
24
+ elif isinstance(value, list):
25
+ base[key] = [merge_ui_configs(base[key], item) for item in value]
26
+ else:
27
+ base[key] = value
28
+
29
+ return base
@@ -0,0 +1,17 @@
1
+ from typing import Any
2
+
3
+ def merge_ui_configs(base: dict[str, Any], override: dict[str, Any]) -> dict[str, Any]:
4
+ """
5
+ Merges two UI configs together. The override config will take precedence over the base config.
6
+
7
+ This function recursively merges two dictionaries representing UI configurations.
8
+ If a key exists in both dictionaries, the value from the override dictionary will be used.
9
+ If the value is a dictionary or a list, the function will merge them recursively.
10
+
11
+ Args:
12
+ base (dict[str, Any]): The base UI configuration dictionary.
13
+ override (dict[str, Any]): The override UI configuration dictionary.
14
+
15
+ Returns:
16
+ dict[str, Any]: The merged UI configuration dictionary.
17
+ """
amsdal/errors.py ADDED
@@ -0,0 +1,31 @@
1
+ from amsdal_utils.errors import AmsdalError
2
+
3
+
4
+ class AmsdalRuntimeError(AmsdalError): ...
5
+
6
+
7
+ class TransactionNotFoundError(AmsdalError): ...
8
+
9
+
10
+ class AmsdalAuthenticationError(AmsdalRuntimeError): ...
11
+
12
+
13
+ class AmsdalDeployError(AmsdalRuntimeError): ...
14
+
15
+
16
+ class AmsdalCloudError(AmsdalRuntimeError): ...
17
+
18
+
19
+ class AmsdalCloudAlreadyDeployedError(AmsdalCloudError): ...
20
+
21
+
22
+ class AmsdalCloudCredentialsError(AmsdalCloudError): ...
23
+
24
+
25
+ class AmsdalMissingCredentialsError(AmsdalAuthenticationError): ...
26
+
27
+
28
+ class AmsdalAuthConnectionError(AmsdalAuthenticationError): ...
29
+
30
+
31
+ class AmsdalSignupError(AmsdalAuthenticationError): ...
amsdal/errors.pyi ADDED
@@ -0,0 +1,12 @@
1
+ from amsdal_utils.errors import AmsdalError
2
+
3
+ class AmsdalRuntimeError(AmsdalError): ...
4
+ class TransactionNotFoundError(AmsdalError): ...
5
+ class AmsdalAuthenticationError(AmsdalRuntimeError): ...
6
+ class AmsdalDeployError(AmsdalRuntimeError): ...
7
+ class AmsdalCloudError(AmsdalRuntimeError): ...
8
+ class AmsdalCloudAlreadyDeployedError(AmsdalCloudError): ...
9
+ class AmsdalCloudCredentialsError(AmsdalCloudError): ...
10
+ class AmsdalMissingCredentialsError(AmsdalAuthenticationError): ...
11
+ class AmsdalAuthConnectionError(AmsdalAuthenticationError): ...
12
+ class AmsdalSignupError(AmsdalAuthenticationError): ...
File without changes
@@ -0,0 +1,170 @@
1
+ from _typeshed import Incomplete
2
+ from amsdal.fixtures.utils import process_fixture_value as process_fixture_value
3
+ from amsdal_models.classes.model import Model
4
+ from collections.abc import Generator
5
+ from pathlib import Path
6
+ from pydantic import BaseModel
7
+ from pydantic.fields import FieldInfo as FieldInfo
8
+ from typing import Any
9
+
10
+ logger: Incomplete
11
+
12
+ class FixtureData(BaseModel):
13
+ class_name: str
14
+ external_id: str
15
+ order: float
16
+ data: dict[str, Any]
17
+
18
+ class BaseFixturesManager:
19
+ ORDER_MULTIPLIER: int
20
+ fixtures_paths: Incomplete
21
+ fixtures: dict[str | int, list[tuple[float, FixtureData]]]
22
+ _class_manager: Incomplete
23
+ _config_manager: Incomplete
24
+ def __init__(self, fixtures_paths: list[Path]) -> None: ...
25
+ def load_fixtures(self) -> None:
26
+ """
27
+ Loads fixture data from the specified path.
28
+
29
+ This method reads fixture data from a JSON file located at the `fixtures_path`.
30
+ It populates the `fixtures` dictionary with the loaded data, where each fixture
31
+ is indexed by its external ID.
32
+
33
+ Returns:
34
+ None
35
+ """
36
+ def _load_fixtures(self, fixtures_path: Path, order_shift: int = 0) -> None: ...
37
+ def iter_fixtures(self) -> Generator[FixtureData, None, None]: ...
38
+ def _process_object_data(self, data: dict[str, Any], model_fields: dict[str, FieldInfo], m2m_fields: dict[str, type[Model]]) -> dict[str, Any]: ...
39
+
40
+ class FixturesManager(BaseFixturesManager):
41
+ """
42
+ Manager class for handling fixture data.
43
+
44
+ This class is responsible for loading, processing, and applying fixture data
45
+ to the database. It supports nested object construction, data processing,
46
+ and file fixture handling.
47
+ """
48
+ def apply_file_fixtures(self) -> None:
49
+ """
50
+ Applies file fixtures from the specified directory.
51
+
52
+ This method processes file fixtures located in the 'files' directory adjacent to the
53
+ `fixtures_path`. It iterates through each file, reads its content, and processes it
54
+ as a fixture. If the file fixture already exists in the database, it updates the
55
+ existing fixture; otherwise, it creates a new one.
56
+
57
+ Returns:
58
+ None
59
+ """
60
+ def _apply_file_fixtures(self, file_dir: Path) -> None: ...
61
+ def _apply_file_fixtures_rec(self, nested_dir: Path, base_dir: Path) -> None: ...
62
+ def apply_fixtures(self) -> None:
63
+ """
64
+ Applies all loaded fixtures to the database.
65
+
66
+ This method processes each fixture in the `fixtures` dictionary in the order
67
+ specified by their 'order' value. It calls the `process_fixture` method for
68
+ each fixture and then processes the data in the processing queue.
69
+
70
+ Returns:
71
+ None
72
+ """
73
+ def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
74
+ def _process_fixture(self, fixture: FixtureData) -> FixtureData | None:
75
+ """
76
+ Processes a single fixture and adds it to the processing queue.
77
+
78
+ This method takes a fixture dictionary, checks if the fixture already exists in the database,
79
+ and either updates the existing fixture or creates a new one. It then adds the fixture data
80
+ to the processing queue for further processing.
81
+
82
+ Args:
83
+ fixture (dict[str, Any]): The fixture dictionary containing the external ID, class name,
84
+ and data of the fixture.
85
+
86
+ Returns:
87
+ None
88
+ """
89
+ def _process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
90
+ """
91
+ Processes and saves fixture object data to the database.
92
+
93
+ This method takes the class name, external ID, and data dictionary of a fixture object,
94
+ processes the data according to the class schema, and saves the object to the database.
95
+ If the object already exists, it updates the existing object with the new data.
96
+
97
+ Args:
98
+ class_name (str): The name of the class to which the fixture object belongs.
99
+ external_id (str): The external ID of the fixture object.
100
+ data (dict[str, Any]): The data dictionary of the fixture object.
101
+
102
+ Returns:
103
+ None
104
+ """
105
+
106
+ class AsyncFixturesManager(BaseFixturesManager):
107
+ """
108
+ Manager class for handling fixture data asynchronously.
109
+
110
+ This class is responsible for loading, processing, and applying fixture data
111
+ to the database. It supports nested object construction, data processing,
112
+ and file fixture handling.
113
+ """
114
+ async def apply_file_fixtures(self) -> None:
115
+ """
116
+ Applies file fixtures from the specified directory.
117
+
118
+ This method processes file fixtures located in the 'files' directory adjacent to the
119
+ `fixtures_path`. It iterates through each file, reads its content, and processes it
120
+ as a fixture. If the file fixture already exists in the database, it updates the
121
+ existing fixture; otherwise, it creates a new one.
122
+
123
+ Returns:
124
+ None
125
+ """
126
+ async def _apply_file_fixtures(self, file_dir: Path) -> None: ...
127
+ async def _apply_file_fixtures_rec(self, nested_dir: Path, base_dir: Path) -> None: ...
128
+ async def apply_fixtures(self) -> None:
129
+ """
130
+ Applies all loaded fixtures to the database.
131
+
132
+ This method processes each fixture in the `fixtures` dictionary in the order
133
+ specified by their 'order' value. It calls the `process_fixture` method for
134
+ each fixture and then processes the data in the processing queue.
135
+
136
+ Returns:
137
+ None
138
+ """
139
+ async def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
140
+ async def _process_fixture(self, fixture: FixtureData) -> FixtureData | None:
141
+ """
142
+ Processes a single fixture and adds it to the processing queue.
143
+
144
+ This method takes a fixture dictionary, checks if the fixture already exists in the database,
145
+ and either updates the existing fixture or creates a new one. It then adds the fixture data
146
+ to the processing queue for further processing.
147
+
148
+ Args:
149
+ fixture (dict[str, Any]): The fixture dictionary containing the external ID, class name,
150
+ and data of the fixture.
151
+
152
+ Returns:
153
+ None
154
+ """
155
+ async def _process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
156
+ """
157
+ Processes and saves fixture object data to the database.
158
+
159
+ This method takes the class name, external ID, and data dictionary of a fixture object,
160
+ processes the data according to the class schema, and saves the object to the database.
161
+ If the object already exists, it updates the existing object with the new data.
162
+
163
+ Args:
164
+ class_name (str): The name of the class to which the fixture object belongs.
165
+ external_id (str): The external ID of the fixture object.
166
+ data (dict[str, Any]): The data dictionary of the fixture object.
167
+
168
+ Returns:
169
+ None
170
+ """
@@ -0,0 +1,9 @@
1
+ from amsdal_utils.models.data_models.reference import Reference
2
+ from types import GenericAlias
3
+ from typing import Any
4
+
5
+ def process_fixture_value(annotation: Any, value: Any) -> Any: ...
6
+ def _cast_value_to_type(value_type: type | GenericAlias, value: Any) -> Any: ...
7
+ def _is_optional(annotation: Any) -> bool: ...
8
+ def _resolve_type_from_optional(annotation: Any) -> Any: ...
9
+ def _construct_reference_value(class_name: str, object_id: Any) -> Reference: ...
Binary file
amsdal/manager.pyi ADDED
@@ -0,0 +1,265 @@
1
+ from _typeshed import Incomplete
2
+ from amsdal.cloud.services.actions.manager import CloudActionsManager as CloudActionsManager
3
+ from amsdal.cloud.services.auth.signup_service import SignupService as SignupService
4
+ from amsdal.configs.main import settings as settings
5
+ from amsdal.errors import AmsdalAuthenticationError as AmsdalAuthenticationError, AmsdalMissingCredentialsError as AmsdalMissingCredentialsError, AmsdalRuntimeError as AmsdalRuntimeError, AmsdalSignupError as AmsdalSignupError
6
+ from amsdal.fixtures.manager import AsyncFixturesManager as AsyncFixturesManager, FixturesManager as FixturesManager
7
+ from amsdal.mixins.class_versions_mixin import ClassVersionsMixin as ClassVersionsMixin
8
+ from amsdal_data.transactions.decorators import async_transaction, transaction
9
+ from amsdal_models.classes.class_manager import ClassManager
10
+ from amsdal_utils.config.data_models.amsdal_config import AmsdalConfig as AmsdalConfig
11
+ from amsdal_utils.utils.singleton import Singleton
12
+
13
+ class AmsdalManager(ClassVersionsMixin, metaclass=Singleton):
14
+ """
15
+ Manages the AMSDAL framework components and operations.
16
+
17
+ This class is responsible for initializing, setting up, and managing various components
18
+ of the AMSDAL framework, including connections, data management, schema management,
19
+ and authentication. It also provides methods for building and tearing down the framework.
20
+ """
21
+ _class_manager: ClassManager
22
+ _config_manager: Incomplete
23
+ _config: Incomplete
24
+ _data_application: Incomplete
25
+ _is_setup: bool
26
+ __is_authenticated: bool
27
+ _metadata_manager: Incomplete
28
+ _auth_manager: Incomplete
29
+ def __init__(self, *, raise_on_new_signup: bool = False) -> None:
30
+ """
31
+ Initializes all sub managers. Reads the configuration.
32
+
33
+ Returns:
34
+ None
35
+ """
36
+ @property
37
+ def is_setup(self) -> bool: ...
38
+ @property
39
+ def is_authenticated(self) -> bool:
40
+ """
41
+ Indicates if the AMSDAL license authentication process has been passed.
42
+
43
+ This property returns a boolean value indicating whether the AMSDAL license
44
+ authentication process has been successfully completed.
45
+
46
+ Returns:
47
+ bool: True if authenticated, False otherwise.
48
+ """
49
+ def pre_setup(self) -> None:
50
+ """
51
+ Initiates models root path and adds it into sys.path.
52
+
53
+ This method initializes the class manager models modules and sets up the models root path
54
+ as specified in the settings. It ensures that the models root path is added
55
+ to the system path for proper module resolution.
56
+
57
+ Returns:
58
+ None
59
+ """
60
+ def setup(self) -> None:
61
+ """
62
+ Initiates models root path and the connections.
63
+
64
+ This method sets up the AMSDAL framework by initializing the models root path and
65
+ establishing connections. It ensures that the setup process is only performed once.
66
+
67
+ Raises:
68
+ AmsdalRuntimeError: If the AMSDAL manager is already set up.
69
+
70
+ Returns:
71
+ None
72
+ """
73
+ @transaction
74
+ def post_setup(self) -> None:
75
+ """
76
+ Registers internal classes and prepares connections (creates internal tables).
77
+ """
78
+ def _check_auth(self) -> None: ...
79
+ @property
80
+ def cloud_actions_manager(self) -> CloudActionsManager:
81
+ """
82
+ Provides access to the CloudActionsManager.
83
+
84
+ This property checks if the AMSDAL manager is authenticated and then returns
85
+ an instance of the CloudActionsManager.
86
+
87
+ Returns:
88
+ CloudActionsManager: An instance of the CloudActionsManager.
89
+
90
+ Raises:
91
+ AmsdalAuthenticationError: If the AMSDAL manager is not authenticated.
92
+ """
93
+ def authenticate(self) -> None:
94
+ """
95
+ Run AMSDAL license authentication process.
96
+
97
+ This method runs the AMSDAL license authentication process and sets the
98
+ authentication status accordingly.
99
+
100
+ Returns:
101
+ None
102
+ """
103
+ @transaction
104
+ def apply_fixtures(self) -> None:
105
+ """
106
+ Loads and applies fixtures defined in your application.
107
+
108
+ This method loads the fixtures from the specified path and applies them to the
109
+ AMSDAL framework. It uses the `FixturesManager` to manage the loading and application
110
+ of the fixtures.
111
+
112
+ Returns:
113
+ None
114
+ """
115
+ def init_classes(self) -> None:
116
+ """
117
+ Initializes and imports classes based on the schema manager's class schemas.
118
+
119
+ This method iterates over the class schemas provided by the schema manager and imports
120
+ the classes into the class manager, excluding those of type `SchemaTypes.TYPE`.
121
+
122
+ Returns:
123
+ None
124
+ """
125
+ def teardown(self) -> None:
126
+ """
127
+ Clean up everything on the application exit.
128
+
129
+ This method performs a cleanup of all components managed by the AMSDAL framework
130
+ when the application exits. It disconnects and invalidates connections, clears caches,
131
+ and resets the setup status.
132
+
133
+ Raises:
134
+ AmsdalRuntimeError: If the AMSDAL manager is not set up.
135
+
136
+ Returns:
137
+ None
138
+ """
139
+
140
+ class AsyncAmsdalManager(ClassVersionsMixin, metaclass=Singleton):
141
+ """
142
+ Manages the AMSDAL framework components and operations.
143
+
144
+ This class is responsible for initializing, setting up, and managing various components
145
+ of the AMSDAL framework, including connections, data management, schema management,
146
+ and authentication. It also provides methods for building and tearing down the framework.
147
+ """
148
+ _class_manager: ClassManager
149
+ _config_manager: Incomplete
150
+ _config: Incomplete
151
+ _data_application: Incomplete
152
+ _is_setup: bool
153
+ __is_authenticated: bool
154
+ _metadata_manager: Incomplete
155
+ _auth_manager: Incomplete
156
+ def __init__(self, *, raise_on_new_signup: bool = False) -> None:
157
+ """
158
+ Initializes all sub managers. Reads the configuration.
159
+
160
+ Returns:
161
+ None
162
+ """
163
+ @property
164
+ def is_setup(self) -> bool: ...
165
+ @property
166
+ def is_authenticated(self) -> bool:
167
+ """
168
+ Indicates if the AMSDAL license authentication process has been passed.
169
+
170
+ This property returns a boolean value indicating whether the AMSDAL license
171
+ authentication process has been successfully completed.
172
+
173
+ Returns:
174
+ bool: True if authenticated, False otherwise.
175
+ """
176
+ def pre_setup(self) -> None:
177
+ """
178
+ Initiates models root path and adds it into sys.path.
179
+
180
+ This method initializes the class manager and sets up the models root path
181
+ as specified in the settings. It ensures that the models root path is added
182
+ to the system path for proper module resolution.
183
+
184
+ Returns:
185
+ None
186
+ """
187
+ async def setup(self) -> None:
188
+ """
189
+ Initiates models root path and the connections.
190
+
191
+ This method sets up the AMSDAL framework by initializing the models root path and
192
+ establishing connections. It ensures that the setup process is only performed once.
193
+
194
+ Raises:
195
+ AmsdalRuntimeError: If the AMSDAL manager is already set up.
196
+
197
+ Returns:
198
+ None
199
+ """
200
+ @async_transaction
201
+ async def post_setup(self) -> None:
202
+ """
203
+ Registers internal classes and prepares connections (creates internal tables).
204
+ """
205
+ def _check_auth(self) -> None: ...
206
+ @property
207
+ def cloud_actions_manager(self) -> CloudActionsManager:
208
+ """
209
+ Provides access to the CloudActionsManager.
210
+
211
+ This property checks if the AMSDAL manager is authenticated and then returns
212
+ an instance of the CloudActionsManager.
213
+
214
+ Returns:
215
+ CloudActionsManager: An instance of the CloudActionsManager.
216
+
217
+ Raises:
218
+ AmsdalAuthenticationError: If the AMSDAL manager is not authenticated.
219
+ """
220
+ def authenticate(self) -> None:
221
+ """
222
+ Run AMSDAL license authentication process.
223
+
224
+ This method runs the AMSDAL license authentication process and sets the
225
+ authentication status accordingly.
226
+
227
+ Returns:
228
+ None
229
+ """
230
+ @async_transaction
231
+ async def apply_fixtures(self) -> None:
232
+ """
233
+ Loads and applies fixtures defined in your application.
234
+
235
+ This method loads the fixtures from the specified path and applies them to the
236
+ AMSDAL framework. It uses the `FixturesManager` to manage the loading and application
237
+ of the fixtures.
238
+
239
+ Returns:
240
+ None
241
+ """
242
+ def init_classes(self) -> None:
243
+ """
244
+ Initializes and imports classes based on the schema manager's class schemas.
245
+
246
+ This method iterates over the class schemas provided by the schema manager and imports
247
+ the classes into the class manager, excluding those of type `SchemaTypes.TYPE`.
248
+
249
+ Returns:
250
+ None
251
+ """
252
+ async def teardown(self) -> None:
253
+ """
254
+ Clean up everything on the application exit.
255
+
256
+ This method performs a cleanup of all components managed by the AMSDAL framework
257
+ when the application exits. It disconnects and invalidates connections, clears caches,
258
+ and resets the setup status.
259
+
260
+ Raises:
261
+ AmsdalRuntimeError: If the AMSDAL manager is not set up.
262
+
263
+ Returns:
264
+ None
265
+ """
File without changes